ER Formats can be run via eInvoicing, Print management (Configurable business documents) or as standalone reports. Standalone ER Formats are those which can be printed via dedicated report menu items.
If the report is executed in batch, the output file(s) are attached to the corresponding record in Electronic reporting jobs. As we know it, each run of an ER Format is logged into the ERFormatMappingRunJobTable table (Electronic reporting jobs).
There are standalone ER reports based on the SysOperation framework, so they consist of Data contract (extending ERFormatMappingRunBaseContract), Service (extending SysOperationServiceBase), Controller and Data provider classes. One such report is AssetRollForward (Fixed asset roll forward).
SysOperation-based ER reports are printed through their report menu item pointing to their controller which extends ERFormatMappingRunBaseController which extends SysOperationServiceController.
There are also ER reports developed with the least number of artifacts; namely they have only an output menu item and the corresponding security artifacts. Such reports are printed using a common controller called ERReportLauncher. One such report is DAS2Report_FR (DAS-2 report).
The ERReportLauncher class runs a report with parameters defined in the report’s menu item. The following parameters are supported:
If a report menu item doesn’t contain parameter FileDestination, the output file will always be downloaded in the browser.
Let’s take a look at the DAS2Report_FR report menu item. Only two parameters ModelGUID and ModelDataContainerDescriptorName are defined for DAS2 report. The other parameters are set to the default value in the class. In our case, the value of the FileDestination parameter is very important. This parameter can take only two values:
- BROWSER - the report is sent to the browser,
- ARCHIVE - the report is sent to the archive.
The default value for the FileDestination parameter is BROWSER, which means that the report is always sent to the browser. This file destination never gets overridden by defined ER destinations. It is always used as an additional ER destination for the report. This is by design.
The solution for this problem is relatively simple. You need to perform the following steps:
- Create a new output menu item for DAS2 report, which must be an exact copy of the existing DAS2Report_FR report menu item.
- Modify the Parameters property of the created menu item by adding the additional parameter FileDestination="ARCHIVE" to the existing list of parameters.
- Create a new extension of the menu AccountsPayable.
- Find the existing DAS2Report_FR menu item (AccountsPayable > InquiriesAndReports) and set the Visible property to false.
- Add the previously created menu item for DAS2 report to the created menu extension.
- Rebuild the code and test it.
Now the generated report will be sent to Archive and to the ER destinations you set up for this report.