D365 F&O Report – Using Report data provider(RDP)
This blog post is about how to create a report using Report data provider.
The objects that we will be creating are
- Data contract class – For parameters of the report
- Temporary table – For storing the records to be displayed in the report
- Data provider class – For processing the business logic of the report
- Action Menu Item – For front end display
- Report – As the name suggests, the report that will be used.
The sample report that i will be creating is a customer details report. I will be using ‘Customer Account Number’ as a parameter. A single customer detail will be displayed in the report.
- First we will create a Data Contract(DC) class
TestCustContractCls
I have implemented SysOperationValidatable class so that we can validate the input parameters. You can implement your logic in validate method as shown above.
- Create a Temporary table for storing data. Set the Table property to ‘InMemory’ so that its a tempTable.
TestReportTmpTable
Add the fields that you want to display.
- Create a Data Provider(DP) class to handle the business logic.
TestCustReportDPCls
This class should extend SRSReportDataProviderBase class. The parameter attribute/Query attribute or both should be linked to the DP class. In my case i am using DC class as a parameter, hence SRSReportParameterAttribute is TestCustContractCls.
We need to create a method which has SRSReportDataSetAttribute attribute which will return data in the TempTable to the reporting services.
The business logic is handle in the doProcess method. In this method, we will insert the records into the temporary table.
- A new report ‘TestReport’ is created.
Go to Report > DataSets > Create a new DataSet > Properties > Data source type > Report data provider.
Click on Query > Select the DP class you created. In my case it is ‘TestCustReportDPCls’.
Choose all the fields you want in the report.
Create a design for your report. For the sake of simplicity, i have used a auto design over precision design.
Right click on Design > Auto design > Drag and drop the dataSource customer onto it.
- Create a Output menu item for displaying the report.
TestReportMenuItem
Set the ObjectType property to ‘SSRSReport’ and Object to ‘TestReport’.
Add the menu Item to a menu bar.
Save > Deploy the report> build the solution.