Building a simple report – Using Report Data Provider

In my previous post, I explained how we can build a simple report using just the AOT queries. Now what if we have some logic that needs to be implemented and cannot be achieved using AOT queries?

This is where Report Data Providers plays a significant roles. Let us take the same example of displaying the Customer Id, Name and Balance that was used in post “Build and Deploy Simple Report–Queries”.

We can have this report using Report Data Providers as well. For this, we will keep the query and create three more artifacts, RDP, Report and a new Output menu item.

First we create a Report Data Provider class named “SKL_SampleReportDP”. Do the following:

To create an RDP for a report, we also need a temporary table (if it is Base Provider) or a permanent table (if it is pre process provider).

For this sample, we will use CustTmpAccountSum table that is present in base product.

Here are the class methods

/// <summary>

/// The <c>SKL_SampleReportDP</c> class is the report data provider class for the

/// SKL_SampleSimpleReportQuery report.

/// </summary>

/// <remarks>

/// This is a sample class. Author: Sumit Loya

/// </remarks>

[ SRSReportQueryAttribute (querystr(SKL_SampleCustomer))]

class SKL_SampleReportDP extends SRSReportDataProviderBase


    CustTmpAccountSum   tmpAccountSum;



The class declaration contains one attribute “SRSReportQueryAttribute”. This attribute specifies the query that will be used for this report. In case no query is required, this attribute can be removed.

There is one other attribute that can be specified on the RDP class and that is SRSReportParameterAttribute. This attribute defines the contract class that will be used to display report parameters.

processReport method

The processReport method is the entry point for calculating the report data for dataset. Here is the method for our sample class


public void processReport()





insertTmpAccountSum method

This is a private method that uses the report query to insert data into the temporary table

/// <summary>

/// This method processes the report query and inserts data into the CustTmpAccountSum temporary table

/// </summary>

private void insertTmpAccountSum()


    QueryRun            queryRun = new QueryRun(this.parmQuery());

    CustTable           custTable;


    while (


        custTable = queryRun.get(tableNum(custTable));


        tmpAccountSum.AccountNum    = custTable.AccountNum;

        tmpAccountSum.Txt           =;

        tmpAccountSum.Balance01     = custTable.openBalanceMST();





getCustTmpAccountSum method

This method is mandatory as it returns the table buffer that contains the processed report data. The Dataset uses this buffer to bind the table to the dataset.

/// <summary>

/// This method returns the table buffer that contains processed data

/// </summary>


public CustTmpAccountSum getCustTmpAccountSum()


    select * from tmpAccountSum;


    return tmpAccountSum;



After creating the class, go ahead and add a new report the existing report model.

  • Open the previously created Report Model


  • Right click on report model, select Add –> Report. Name the report SKL_SampleReportDP
  • Now in the report, go to the Datasets section and create new Dataset using the name CustomerDP
  • The parameters for the new Dataset should be as shown below. The Data Source Type is “Report Data Provider”


  • In the query property, click the button image_thumb6
  • This opens a box to select a data provider class
  • Select the class we created before, SKL_SampleReportDP and click “Next”


  • In the next tab, Deselect all fields and just select “AccountNum, Balance01 and Txt” fields
  • Click Ok


  • This is how the data set looks like


  • Now create a new Auto Design as before and name it as CustDP, Select a Layout Template for the report design in Parameters window
  • Now right click on newly created design select “Add” and “Table”
    • Set following properties
      • Name – CustDP
      • Dataset – CustomerDP
      • Style Template – TableStyleAlternatingRowsTemplate
  • You will also notice that the fields are included automatically from Dataset to the “Data” node of the table


  • Now right click on the report model and select option “Add SKL_SampleReportProject to AOT”
  • Once the report is created back to AOT, go to AX, find the report in AOT –> SSRS Reports –> Reports, right click and deploy using “Deploy Element” option
  • Once the deployment is successful, create an output type menu item for the report
  • Go to AOT –> Menu Items –> Output, Right click and select “New Menu Item”. Set following properties


Now using menu item open and run report. You will notice the same dialog


The report looks like as shown below:



5 thoughts on “Building a simple report – Using Report Data Provider

  1. Hi sir,

    I have to generate multiple report at one time and condition for the report is that we have to create one report for every customer but for every customer there are many journal lines and for every journal lines there are many invoices/documents ,so when we open the report all the reports of each customer should be open in one click.Do you have any idea that how we can do it

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 )

Google photo

You are commenting using your Google 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 )

Connecting to %s