Wednesday, October 5, 2016

Duplication SSRS for AX 2012 R3

Here is a light post to duplicate SSRS report on Microsoft AX Dynamics.
This is not a standard feature of AX Dynamics (with a good wizard for example). So your need to do that manually, adapting all components of your new report and business logic.


SSRS report is composed by many class and objets, so to duplicate an existing report, you need to duplicate certain or all composants. I listed main components and steps just below :

- Duplicate Controller, Contract, and Data Provider classes on AOT (MorphX) (& Tmp tables "attached" on Data provider if you need to use them)
- Duplicate the query associated on the Data Provider Class
- If controller is not overhead because your report template use super classes (srsReportRunController to start operation), you could create it duplicating other one. Check Type Hiearachy Browser on SrsReportRunController class to show all extended controller class. Adapt main class and modify/create class to custom it (prePrompt, preRunModifyContract for example)
- Duplicate SSRS report with Visual Studio AOT solution explorer (this option is available only in VS)
- Duplicate also the Business Logic class (C# project) if your template report contains business methods. You need to do that, export C# Projetct in XPO and modify name of class, Origin GUID and name of .cs. (See link below for that)
- Create a new project on Visual with the new name of report and add the duplicated report
You need after set the report and parameters properties with new objects :
* Data provider to fill DataSets (this is the query which select data from data provider, a propertie in the DataSets of your report.
* Check parameters (after duplication, parameters is sometime duplicate also)
* Change the business logic of report (properties of the report --> Data Method Library which contains methods of the report.

Build the report (without any error) and publish it with Microsoft AX Dynamics Management Shell program with the command :
Publish-AXReport -ReportName myReport

Don't forget to debug your report to :
- Activate breakpoint in Server configuration
- Run as administrator the debugger
- Put a breakpoint keyword in your code (process report for example)

Thank you to this post : http://axvuongbao.blogspot.fr/2013/08/how-to-duplicate-ssrs-report-in-ax2012.html for Business Logic duplication.

There is a tool to duplicate report on AX 2012 (provide by Sreenath) but if you could to this manually, it's a good training to keep the logic of SSRS feature in Dynamics AX.