When working with custom layouts in Business Central, you sometimes end up in a situation where the system cannot find the layout it is looking for. In cases like this, the report is run with an empty layout. Empty layouts make the report execution fail.
Why is my layout empty?
Empty layouts can happen for several reasons. For example:
- Your report is set to use a custom layout that no longer exists in your database.
- Your report is set to use a custom layout unavailable in the current company.
- The selected report layout is empty.
How can I fix this?
A good place to start looking for the problem is the Report Layout Selection page in Business Central. Check that the report has the proper layout selected. You should also check the master sections used in the report, if any.
If both your report and the template reports (with master sections) have a valid custom layout selection, then you must ensure that the selected layouts are available to the current company. To do this, in the
Custom Report Layouts page, find your layouts in the list and check that the Company field value is either the current company name or a blank value. You can use the layout in all companies if the value in this field is blank. This is typically what you want because it reduces the likelihood of the empty layout problem.
Even if all the settings look right, you could still have an empty custom layout. The most common reason for an empty layout is if your layout reference in an AL file points to the wrong layout file location. When the AL-compiler cannot find a layout in the specified location, it creates an empty layout in your AL project. These built-in layouts can then be copied to custom layouts.