Sub-Reports in Openbravo

Report is one of the key USP for any ERP application. The more enhanced and flexible the reports are, more happy is the customer. In Openbravo, jasper reports provides us the flexibility to handle all this. iReport is one  tool that can be used to create jasper reports. I have provided a simple example of how to add sub-report for an Openbravo Report using iReport.

Main Report:

Assume we have created a main report with the following query and layout.

Adding Sub Report:

The Sub Report can be created by adding the sub report icon as follows.

The sub-report can be added by drag and dropping the highlighted portion in the above screen shot. It will open the sub report wizard.

The sub report can be created in any one of the following three ways. Each way has different number of configuration steps.

1. A new sub report can be created using the wizard by using the “Create a new Report” Option. This will ask for all the options needed to create a new report including the report query. This will go through all the 7 steps.

The Sub Report expression can be any one of the following two options.

1. Through SUBREPORT_DIR Parameter

This will create a parameter SUBREPORT_DIR in Main Report. We have to point this parameter to the folder containing the sub report.

2. Through absolute path.

2. We can also call a already existing report as a sub report. This can be done by “Use an existing Report”  option. We have to provide the path of the existing report. This will directly go to step 6 skipping the steps before that.

3. The last option will just create a blank sub report.

Adding Parameter:

In the Report Properties window, there is an option called parameter. This option enables us to add the parameter for that particular report.

Any number of parameters can be provided to the report through this option.

Sub Report Query:

Note that you can see the parameter in the available parameters list in the above screen shot. We can also add the parameter through the “New Parameter” button in the above screen shot.

Importing Report in Openbravo:

For importing the report into openbravo,  the jrxml files should be placed inside your module. For instance, if your module is XYZ with the Java Package com.fugoconsulting.XYZ, then the jrxml file should be inside the folder modules/com.fugoconsulting.XYZ/src/com/fugoconsulting/XYZ/erpReports/.  Before importing the report into openbravo, we need to give the relative path for the sub-report and the images that  we have added. This will make the report work in all systems irrespective of the path of the report. In order to give relative path, you need to add the following two parameters in main report.


This parameter will be resolved at run time and will be pointing to your module folder(In our case modules/com.fugoconsulting.XYZ/src). The sub report expression must be modified as follows. This can be modified using the property “Sub report Expression”.


This parameter will be resolved to point the web folder at run time. This parameter is used to give the relative path for images. The sub report expression must be modified as follows.

Registering in Reports and Process:

Create menu and compile the application. The output will be,

For creating charts using iReport refer here.

About Pandeeswari Ramakrishnan
Applications Engineer, Openbravo

7 Responses to Sub-Reports in Openbravo

  1. Mark says:

    Hi what version of iReport are you using?

  2. Mark says:

    That sounds great! Can I also add sub report to OB main Sales Order?

  3. Mark says:

    I see. Thanks! 🙂 Oh one more thing, is it possible to separate my tax from Order Line? I’m trying to put it beside the total amount in Sales Order Report but to no avail. :I

    • Yes you can. You can get the tax amount from the tax tab of the Sales Order Window for the entire Sale Order. If you want to get the tax amount for each order line, then I think you need to calculate it using the tax linked for that order line.

  4. venkata reddy dwarampudi says:

    Hi Guys,
    I am working on the jasper reports for openbravo. I have 4 jasper reports in which
    sample is main report. It contains sample 1 and sample2 are sub reports. Sample 2 contains a subreport called sample2_subreport. It works on the ireport designer. If i configured samle report in the openbravo application dictionary not working and also not giving type of the error.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: