ADVERTISEMENT
AL Objects and Extensibility

Reports in AL

Learn about reports in AL and how they are used in Business Central. Understand report objects, datasets, layouts, processing-only reports, and reporting concepts in AL.

What you will accomplish

Use a report object for a new owned dataset and output, or for processing-only work that genuinely belongs in a report. Do not start with the layout: first define the data grain, filters, and expected totals.

Before you start

Know tables, keys, and basic AL triggers. Prepare a small, reconciled dataset in a sandbox and decide whether the report is analytical, document, or processing-only.

Expected learning result

You should be able to create a dataset, run it with a request filter, inspect data-only output, and explain the difference between data correctness and layout correctness.

Reports in AL
Reports in AL

Reports in AL are used to present, process, and sometimes transform business data stored in Business Central tables. While reports are often associated with printing documents, their role is broader: they are also used for batch processing, background execution, and structured data output.

This page explains what reports are, why they exist, and how they are structured, with practical AL examples. It focuses on understanding reports as data-driven execution objects, not just print layouts.


What Is a Report in AL?

A report in AL is an object that reads data from one or more tables, processes that data in a defined sequence, and optionally produces an output such as a printed document, PDF, Excel file, or no output at all.

A report defines:

• Which data is read
• How records are iterated
• When logic is executed
• How output is generated (or suppressed)

A report does not:

• Store data
• Replace posting logic
• Act as a UI editing surface

Reports are read-oriented and execution-focused objects.

Why Reports Exist in Business Central

ERP systems must support:

• Business documents (invoices, orders, statements)
• Regulatory and financial reporting
• Periodic batch processing
• Data exports and analysis

Reports exist to handle these needs in a controlled, repeatable, and auditable way. They allow data to be processed consistently across large record sets, which is difficult to achieve through pages or codeunits alone.

Two Common Uses of Reports

Although reports can be flexible, they are commonly used in two ways.

First, reports are used as output documents, where data is formatted and presented to users or external parties.

Second, reports are used as processing engines, where data is read and logic is executed without producing visible output.

Both uses rely on the same report structure.

Basic Structure of a Report in AL

A report typically consists of:

• Report properties
• Dataset definition
• Optional request page
• Optional triggers
• Optional layout (RDLC or Word)

Each section serves a specific role and should be kept cleanly separated.

The following example shows a report that processes data without printing anything.

Simple Processing-Only Report Example

AL

report 50130 "Customer Feedback Processor"
{
    ProcessingOnly = true;
    UsageCategory = Administration;
    ApplicationArea = All;

    dataset
    {
        dataitem(CustomerFeedback; "Customer Feedback")
        {
            trigger OnAfterGetRecord()
            begin
                // Processing logic per record
            end;
        }
    }
}
    

This report:

• Iterates through records
• Executes logic per record
• Produces no output
• Can be scheduled or run manually

ADVERTISEMENT

Dataset and DataItems

The dataset defines which tables the report reads and in what hierarchy. Each dataitem represents a table and controls record traversal.

A dataitem:

• Reads records sequentially
• Can be filtered
• Can contain triggers for record-level logic

Multiple dataitems can be nested to represent header–line relationships.

Example: Report with Header and Line DataItems

AL

dataset
{
    dataitem(Customer; Customer)
    {
        dataitem(CustomerFeedback; "Customer Feedback")
        {
            DataItemLink = "Customer No." = field("No.");
        }
    }
}
    

This structure:

• Iterates customers
• Then iterates related feedback records
• Mirrors relational data structure

Request Page (User Input)

Reports can include a request page that allows users to:

• Set filters
• Choose options
• Control execution behavior

Example: Request Page

AL

requestpage
{
    layout
    {
        area(Content)
        {
            group(Options)
            {
                field(IncludeBlocked; IncludeBlocked)
                {
                    ApplicationArea = All;
                }
            }
        }
    }
}
    

The request page is optional and can be disabled for automation scenarios.

Report Properties (High-Level Understanding)

Report properties define how and when the report runs. Common properties include:

• ProcessingOnly
• UseRequestPage
• SaveValues
• DefaultLayout
• UsageCategory
• ApplicationArea

These properties should be used to control behavior before adding code.

Report Triggers (When Logic Runs)

Reports support triggers at different levels:

• Report-level triggers (e.g., OnPreReport)
• DataItem triggers (e.g., OnAfterGetRecord)
• Request page triggers

Triggers should be used for:

• Initialization
• Controlled processing
• Output preparation

They should not replace core business logic.

ADVERTISEMENT

Reports and Batch Processing

Reports are commonly used for:

• Period-end routines
• Data corrections
• Recalculations
• Scheduled background jobs

Because reports process records sequentially, they are well-suited for controlled batch execution.

Layouts in Reports (High-Level Only)

When reports produce output, layouts define how data is rendered. Business Central supports:

• RDLC layouts
• Word layouts

Layout design is a specialized topic and is covered separately.

Common Beginner Mistakes With Reports

Developers often:

• Use reports to modify data incorrectly
• Put heavy business logic in report triggers
• Ignore filtering and performance
• Treat reports as UI objects

Reports should process data responsibly and predictably.

Summary

Reports in AL are data-processing and output objects used to read, process, and optionally present business data. They are a core part of Business Central’s reporting and batch execution model.

A well-designed report:

• Reads data efficiently
• Uses properties before code
• Separates processing from presentation
• Supports automation and auditing

Understanding reports prepares you for advanced topics such as Report Extensions and background job execution.

Practical check: Build a filtered customer balance dataset

Create a simple analytical report listing customers with a date-filtered balance and a count of included customers. Keep the first version focused on dataset verification.

Steps and evidence to inspect

  1. Define the Customer dataitem, required columns, calculated value, and request filter fields.
  2. Run the report for a known subset and export/send the data-only Excel output if available.
  3. Reconcile row count and totals before designing Word, Excel, or RDL presentation.

Expected result

The dataset contains only the selected customers and its totals match the same filters in Business Central. Layout work begins only after that check passes.

If the result is different

Wrong numbers are usually filter, FlowField/CalcFields, dataitem, or date-context problems; clipped text and pagination are layout problems. Diagnose the correct layer.

Version and implementation boundary

Report row, document, and execution limits protect the service. Test realistic volume and scheduling behaviour; do not infer performance from a ten-row demo.

Authoritative reference: Microsoft Learn — Report object. The scenario and interpretation above are original to ScrutnLearn.

Stay Updated

Get the latest tutorials, tips and resources delivered to your inbox.