With the release of Microsoft Dynamics NAV 2015, the way reports are executed has changed. In Microsoft Dynamics NAV 2015, reports can use a built-in RDLC layout (as before), a built-in Word layout, or a custom layout, which can be based on RDLC or Word. Built-in layouts are part of the report object, while custom layouts are stored in table 9650 Custom Report Layout of the database. The new behavior relies on a few new functions in codeunit 1. Additionally, Microsoft Dynamics NAV 2015 introduces the capability to schedule a report for execution later. This functionality also relies on codeunit 1 triggers, as well as a few new C/AL functions.
This section explains what happens behind the scenes when a report is executed. A report is executed when any of the following happen:
The following figure illustrates the sequence of interactions between the platform and codeunit 1 functions when a report is executed.
The execution of reports that use Word layouts consists of two parts: design time and run time.
The following figure illustrates the different components that are involved in the Word layout authoring and merging:
As mentioned in the previous section, the Word layout documents are handled by the following function in codeunit 1:
As you can see, the function has to handle all report actions, including printing. Although SaveAsExcel is included in the code, a function call with this parameter will result in an error message that states that this function is not available.
Note: FileName is used for SaveAsPdf and SaveAsWord. However, it is also used for server-side printing, in which case, it specifies the name of the server-side printer. Client-side printing is done through Word.
In Microsoft Dynamics NAV 2015, a report can be scheduled for executing later from the Job Queue. This functionality relies on a new codeunit 1 function and a set of new C/AL functions that support the delayed report execution. When a report is run from the client, it can be run by calling either the RUN or RUNMODAL function. The RUNMODAL function is used when the system expects the report to be executed in the current context, in other words, when the results are needed immediately. This is the case, for example, with the Copy Document action that is invoked from a new sales order. Reports that are executed by the RUNMODAL function cannot be scheduled. The user can only schedule reports that are executed by the RUN function.
It is important to note that most document reports are run by using the Report Selection feature, which uses the RUNMODAL command to execute reports in sequence. Therefore, when printing, for example, a Sales Invoice, the user will not see a Schedule option on the report request page. However, if the Sales Invoice report is run directly from Object Designer in the development environment, the request page will include the Schedule option, as illustrated in the following figure.
When the user chooses Schedule on the request page, the report is not executed immediately. Instead, the codeunit 1 function ReportScheduler@79(ReportId:Integer;RequestPageXml:Text):Boolean is called, where the ReportId parameter specifies the report’s ID and the RequestPageXml parameter specifies the request page parameters as an XML string. This function creates a new record in table 472 Job Queue Entry where it stores the RequestPageXml parameter value (the Job Queue Category Code field is left blank). Before the function inserts the new record in the Job Queue Entry table, page 682 Schedule a Report opens in the client and enables the user to choose the report output type and when to run the report. The following figure illustrates an example of the Schedule a Report page for the report 111 Customer Top 10.
After the Job Queue processes an entry for a report, if the output type is Word, Excel, or PDF, the Job Queue will create an entry for the report in table 477 Report Inbox table. In the client, the entry will appear in the user’s Role Center in the Report Inbox part. Because there is only one Report Inbox table, which is shared by all users, the Report Inbox part is filtered on the user’s ID.
C/AL Functions Used by Job Queue for Reports
When the Job Queue processes the report request, it uses on the following new C/AL functions:
Расскажите о новых и интересных блогах по Microsoft Dynamics, напишите личное сообщение администратору.
|Опции темы||Поиск в этой теме|