INTEGRATING IREPORTS WITH ADEMPIERE

 

Integration with ADempiere was started by Trifon helped AlejandroJohannes and Heng Sin.

JasperReports is a powerful open source Java reporting tool that has the ability to deliver rich content onto the screen, to the printer or into PDF, HTML, XLS, CSV and XML files. JasperReports will allow you to generate wonderful reports, including reports with subreports into them.

Deploying IReport in Adempiere – Internal and External :-

  • External Report – These are those reports whose menus are created by us , and parameters are defined by us and when user clicks on it the parameters are passed on the report and the report is called. In Order to create and integrate such report performs the following steps.
  • Create the Report in the IReport tool or any JasperSoft Tool such that the report is being compiled and running on the IReport.
  • While defining the parameters make sure the name is same as DB Columns in table.
  • Once the report file is made segregate the report in the war file.
  • War file can be created in eclipse by creating a new project and then exporting it to WAR or importing already created war in eclipse so that the reports can be added in the project.
  • Once Reports are added in the WAR file u need to transfer this file to the right destination which is in ServerOssagho_2.0OssaghojbossserverAdempiereDeploy . And paste the War file here.
  • Once the War file is kept on the place, u need to create report process in the AD i.e on the front end.
  • In Order to create that , login  with the System Admin provision and go to Report and Process menu and click on new button.

image002

  • Enter the name and select the path of report in the AD tool such that the report  can be accessed

image004

  • Go to the Parameter tab and create Parameters such that  the names are similar to the parameters created in IReport. For Instance the parameter for Product is defined as follows:

image006

  • Here System Element is the DB column name, which is already in DB while the DB Column name will always be similar if anything is present in the System Element Field.
  • Reference used here is Search such that when the parameter appears we get a drop down of all the Products.
  • The Mandatory and Default Logic Fields are optional such that if the client wants any parameter to be mandatory or some default value to be passed in the parameter every time it is left empty.
  1. Once the Parameters are done you need to create the menu for the report and segregate the report in the AD menu. It can be done by clicking new button in Menu Window and then choosing “Report and Process” in Menu Tab .
  2. Once Menu is created you can move it to any Folder u want, or if detailed Segregation is needed, we can also create folders.
  3. Logout from System Admin and login Hero Admin mode and run the report after Inserting Parameters
  • Internal Report :- These are those reports which are applied internally and for whom menus are not created , they are just used for prints of orders, receipts and invoices or any window or any form in Adempiere.These reports can be applied on the window as follows:
  1. Create the Report in Ireport such that the report is created with just a single Parameter in Ireport i.e. Record ID.
  2. Here Record ID should be the ID that is automatically passed to the Report when we segregate it as Internal report
  3. Once the report is made you need to create a Report in Front End in Report & Process as follows:

image008

 

  • Here the Changes from the external report are
  1. Click on the Report checkbox , making it an Internal Report
  2. In the Classname you can optionally add “org.compiere.report.ReportStarter”.
  3. In Parameters tab we will not add any Parameters as the only parameter in the report is Record ID which will be automatically passed on to the Report.
  • Once we have added the Report in Report and Process we will now define it in the form we need to create such that AD knows which report is associated with which window.
  • As the above report is for Purchase Invoice Window we will Add it in the Purchase Invoice Window. This will be done as follows:
    1. Open Window Tab & Field and search for Invoice(Vendor) and open the first or the Main tab of the Window.

image010

  1. Here as shown in the Process field enter the report name which is created and save it.
  • Now the Internal Report will function on the click on Print Preview in the Desktop  Version and Print Button in Web UI Version.

 

Points to Note in while Integration of Reports:-

  • Parameters Name in IReport should be taken utmost care and the name should be same as the columns created in the DB. To make sure the name is same both you could use the help of E2 desktop or Web Version and login in System Admin and open Report & Processand open Parameters tab as shown below

image012

  • While Creating a Report with the List Parameters in It, make sure u define list as the reference as shown below.

image014

 

  • Create reference key such that it must contain the same Search key as parameters used in Report as shown in the screen below.

image016

  • Here we have used, N and Y as the Search key for sale and purchase such that we will pass these to IReports at Runtime.
  • Do keep in Mind as to not Insert DB Column in list Parameters even if it exists in Database as that will lead to non Running of report.

 

In Case of Report not working or Displaying Blank Pages following  are the Cases that can occur, Do check these Cases:

  • Check number of Parameters in I Report and Parameters in AD and match the Parameters.
  • Once parameters are same, you need to check that there are no spaces in the Parameter name in iReport, In Such Cases the Report will work in IReport but the same will not work in Adempiere .
  • Organization Parameter also needs to be always added in every Report as it is necessary.
  • For Debugging the Report do look at the Console and find out what exactly is the error.
  • For checking the Path copy the Path and Paste it onto Browser and see if data is retrieved, if we get error means path needs to be corrected.
  • Do make sure that the Server is switched On , else reports won’t work at all, this can be found out by using web UI.
  • Use 7 Zip for changing the report data, or adding data in already prepared WAR file, this saves the time and energy wasted while using Eclipse but this should only be used for quick changed and minor touch ups.
  • Open the WAR file with 7 Zip and double click on the Report you would like to edit
  • Edit the report and compile it and close it and make sure    you select the OK in the Reflect Changes box.

 

Exporting IReport to Excel in E2

POINTS TO REMEMBER

  1. When we create IReport in Jasper Reports and export it on click of Print Button of Adempiere E2 Client. Following are the points you need to keep in mind:-
    1. The Field Alignment should be always correct as shown below:

image018

 

  1. As shown above the following errors are in the above PF Contribution Register which need to be removed here:-
  •    Organization and PF Contribution Register are overlapping which results in mislap of the field in the Excel Export.
  • When u export such ireport to excel you will get the  following output.

image020

  •   As shown above the following excel export has skipped columns i.e A to Z are not in sequence and some fields are missing like Organization name due to the overlapping.

[divider]

In Order to remove these errors you need to incorporate the following changes while creating or editing the report

 

  • Do not overlap any fields on one another as this may lead to hiding of columns in excel. In order to check the point that no field overlaps one another select all the fields

image022

  • Keep all the fields in the same line and make sure that the fields on top and bottom also stay in the same line as follows:

image024

 

 

 

-By Adempiere Support {India Portal}

About This Author

Post A Reply