The application needs to determine when to run which layout because a report can have built-in layouts (RDLC and/or Word) and custom layouts (RDLC and Word).This is handled via several codeunits that follow a report execution flow. The following figure visualizes this flow:
This flow is executed when you run a report from the application and select Print, Preview or when you run a report via C/AL code:
First, the codeunit uses the
HasCustomLayout()
function to determine if the report has been set up with a custom RDLC or Word layout. If not, the default built-in layout is used.If the report has a custom or built-in Word layout, the
MergeDocument
function manages the report execution.If the report has been set up to use a custom RDLC layout, the
ReportGetCustomRDLC
function returns the custom RDLC layout as an XML string and that is used to render the report.