Developers Manual/Creating reports using Jasper Reports
Contents |
Introduction
Openbravo has been integrated with JasperReports, so now there is a new way to develop reports for Openbravo ERP. Both methods are going to be available, each one with its own strengths.
XmlEngine permits total control of the output page as the template is programmed in the output format, html or fop. Also, with XmlEngine it is possible to include links and ajax technology.
JasperReports uses an intermediate format and permits the ability to export the report to several different formats, html, pdf, excel, csv,... It also has a very advanced development tool (iReport) that makes the design of new reports very easy. The management of the computer resources is better resulting in a faster generation of results for large reports.
This integration has been focused on two main goals, the possibility of uploading a Jasper Report template to the application and defining the parameters needed to be able to open it from the application menu. Additionally, the focus included improving the export of the grid from the windows switching to Jasper Reports and including new output formats.
Creating the Template using iReport
Check how to create the Jasper Report Template using iReport
Adding the Report to Application Dictionary
There are 2 ways to add a new report to the application:
- By creating a servlet that builds the filter window and generates (compiles) the output or developing only the Jasper Report template
- Or using a generic servlet to enter parameters and compile the output.
Adding your report to Openbravo
- Login into Openbravo as System Administrator
- Go to Application Dictionary > Report and Process
- Click New Icon
- Fill the new Report data. e.g.
- Search Key: RPT_MPRODUCT
- Name: Product List Report
- Mark the Jasper Report checkbox (A textbox will appear with JR Template Name)
- JR Template Name:
@basedesign@/org/openbravo/erpCommon/ad_reports/m_product.jrxml
- Notes:
- The JR Template name is the path were the .jrxml is located.
- The @basedesign@ will be replaced in runtime with:
your_tomcat_context/src-loc/design
If you are using the base language, or if you are using a different language, will append the folder language at the end, e.g. In Spanish will be:your_tomcat_context/src-loc/es_ES
Adding the report to the Menu
- Go to General Setup > Application > Menu
- Click New icon
- Fill the necessary data
- Name: Product List Report
- Action: Process
- Process: Product List Report
- Click Save icon
Compiling the application
You need to compile the application in order to see the changes. The compile process will copy the .jrxml template to tomcat context, and generate a new actionButton.
ant compile.development -Dtab=XX
Testing the Report
You need a Jasper Report template and this template must be registered in the Application Dictionary, after that follow this steps to test your report:
- Login as with a user that has Openbravo Admin role
- You should see a new item 'Product List Report' at the end.
- Click on the option
- A new pop-up window appears. Click on OK
- The report should be displayed. As you may get a empty report. Is the way that Jasper Reports makes the layout. Change the template (.jrxml) with iReport, and make sure that no textfield and labels overlap each other.
A zoom in of your report template in iReport:
The same report above, with the layout problem fixed. After recompiling you should get something like this:
Known issues:
- You don't have access to access this page error message. TBD
Working with parameters
TBD
Working with Sub-Reports
TBD
Category: Development












