Let’s look at an example where you may want to create a ‘Purchase Requisition Report’ that the users could generate to see the status of each purchase requisition and the associated workflow entries for that Purchase Requisition.
I will not go into the details of how to develop this report, but you should know that such a report do not exist in the out-of-the-box functionality within AX 2009.
So let’s say that you have developed this report and now when you generate this report you can pass on the required ‘Purchase Requisition ID’ in the ‘Parameter Prompt’ of the report to view the particular PR details accordingly.
However, now in the next step you want to call this report from the ‘Purchase Requisition’ Form (PurchReqTable).
To do this, you should first create a ‘Button’ within the Button Group in the Form.
Now right-click on the ‘Methods’ node within the newly created button and choose ‘Override Method –> clicked’
Within the clicked function, you should write the following code;
Args args = new args();
reportRun = classFactory.reportRunClass(args);
The above code calls the ARGS system class. This class is used to pass arguments to a class-constructor. You pass information such as name, caller and parameters to a ARGS class. This code passes the relevant Purchase Requisition ID (which is currently selected by the user on the form) to the report ‘PurchRequisitionDetails‘
Now, you need to go to the Form (which in this case is PurchReqTable).
Right-Click on the methods node of the Form and click on Override Method –> init()
In this init() method, you need to enter the following code to allow the report to read the parameters from the form.
public void init()
info(“Error in init method”);
You should now be able to generate your report directly from the form with required parameters.