-->
There can be reasons to add a new design to an SSRS report
  •  Have multiple designs side by side and print each for specific scenario
  • Have the new customized design deployed while preserving the original one
  • Have designs for different localization (As seen in AX default reports)
Its your choice. I used to keep the original report layout and fields so that I can get to the previous state whenever I want without worrying of any XPO imports. For a simple report, this may be as straightforward as mentioning the report deign name in the ssrsReportName method as follows;

However for control documents (reports generated at each specific state of a business document), this needs one more level of definition.

Set Custom design from code

Normally the report name is provided to the class as follows
controller.initArgs(_args, ssrsReportStr(SalesPackingSlip, report));

The ssrsReportStr method takes 2 parameters
  1. The report name - string
  2. The deisgn name - string
For control documents, this alone is not enough. Control document designs / formats are to be configured from the Print management feature provided in setup.

Path: -> Setup .> Forms -> Forms Setup
e.g. Accounts Payable > Setup > Forms > Forms Setup


The form provides each control document identified by the system and report and its format associated as default.

But your custom design won't appear in the configuration form unless a system class is modified for the same. There is a class with the name, "PrintMgmtDocType" with a method, 'getDefaultReportFormat()'. The default report design of a control document is resolved when the framework calls this method. You will notice that all the different localization based report formats are mentioned under the localization checks. In order for your custom design to appear in the configuration, you will have to return your custom design in some condition in this method.

For example, suppose you have added a new custom report design for sales invoice report. The code modification may look as follows;
case PrintMgmtDocumentType::SalesOrderInvoice:
if (SysCountryRegionCode::isLegalEntityInCountryRegion([#isoEE]))
{
    return ssrsReportStr(SalesInvoice, ReportEE);
}
return ssrsReportStr(SalesInvoice, CustomDesign);

You may add conditions like configuration key checks, company name, localization, menu item checks etc to decide which design to load.

Also note that these designs are originally built in the Visual Studio IDE (reporting tools extensions). When the AX model is build in visual studio and compiled in AOT, the new dsesign name is also available in X++ and would get compiled. Otherwise, the AOT may give error and may not recognize the new design. After the above code, the Print Management setup form would look like this;


Select the custom design and generate the particular control documents to see your new design in action :)

0 comments:

Post a Comment

top