ABAPbeginner

ABAP Reporting: Classical & Interactive Reports

Building list-based reports using events like AT SELECTION-SCREEN, START-OF-SELECTION, and interactive drill-down with AT LINE-SELECTION.

A classical report is a program whose structure is defined by events the runtime fires in a fixed order. You do not write a main routine; you fill in the events.

A classical report is like a factory assembly line with fixed stations (events) the raw material (data) passes through in strict order; interactive drill-down is like a store directory where clicking a department name takes you to a more detailed aisle map.

Key Concepts

1
The order they fire.
    INITIALIZATION        before the selection screen is shown
                          (set default values here)
    AT SELECTION-SCREEN   after the user presses execute
                          (validate input; errors return to the screen)
    START-OF-SELECTION    the main work
    END-OF-SELECTION      after the main work, before the list appears
2
A program with no event blocks at all is treated as one big START-OF-SELECTION, which is why short reports appear to have no structure.
START-OF-SELECTION
3
The selection screen is declared, not drawn.
    PARAMETERS     p_bukrs TYPE bukrs OBLIGATORY.
    SELECT-OPTIONS s_budat FOR  bkpf-budat.
4
The difference between these two is a standard question. A PARAMETER is one value — a single input box. A SELECT-OPTION generates an internal table with four columns:
PARAMETERSELECT-OPTION
5
    SIGN   OPTION   LOW          HIGH
    I      BT       2026-01-01   2026-03-31    include, between
    E      EQ       2026-02-14                 exclude, equals
6
So one select-option can express "January to March, but not the 14th of February", and the user builds that through the multiple-selection dialog. Because it is a range table, it drops straight into a WHERE clause:
WHERE
7
    SELECT * FROM bkpf WHERE budat IN s_budat.
8
A select-option left empty means "no restriction", not "nothing" — which is why an unguarded report can select the whole table.
9
Interactive reporting: drill-down before ALV existed. A user double-clicks a line and gets a detail list:
10
    AT LINE-SELECTION     double-click on a list line
    AT USER-COMMAND       a toolbar button or function code
    AT PP-ON-VB           print events, rarely used now
11
The problem to solve is knowing which line was clicked, since the list is text. Two mechanisms answer that:
12
    HIDE lv_belnr.        " stash a value against the current line
    GET CURSOR FIELD ...  " read what the cursor is on
13
HIDE stores the variable for that line and restores it automatically when the line is selected. SY-LSIND tells you which list level you are on, so one event block can serve several levels.
HIDESY-LSIND
14
When to still use this. Background jobs producing a spool list, technical and debugging reports, and small internal utilities. It is quick to write and has no framework around it.
15
When not to. Any report an end user sees regularly. They will want sorting, filtering, subtotals and export to Excel, and writing those by hand is work ALV already does. In S/4HANA the same requirement is usually a Fiori list report over a CDS view.
16
The judgement being tested is whether you pick the tool for the audience, rather than the one you learned first.
17
What the interviewer is probing.1. "Why does AT SELECTION-SCREEN matter?" Probing: the event model. Stalls: "Nothing." Moves up: it is where input validation belongs, so bad parameters are rejected before any database work starts.
18
2. "What is the order of the main report events?" Probing: the sequence. Stalls: "Start of selection." Moves up: INITIALIZATION, AT SELECTION-SCREEN, START-OF-SELECTION, END-OF-SELECTION, then list events — knowing this is how you place logic correctly.
19
3. "How do you build drill-down behaviour?" Probing: the technique. Stalls: "A second report." Moves up: secondary list events with HIDE and the system fields, or far more maintainably an ALV with an event handler.
20
4. "Why would you write a classical list report today?" Probing: honesty. Stalls: "They are better." Moves up: rarely — ALV or Fiori is the expectation; classical lists survive mainly in old batch output.