An Interactive Report in ABAP is a report that lets users interact with the list (usually by clicking on a line or hotspot).
When the user clicks, the program reacts to the event and shows secondary details (like drilling down).
Classic mechanism: Events AT LINE-SELECTION, AT USER-COMMAND, AT PFx.
Example Scenario (using MARA
→ MARC
)
- Basic list (Level 1): Show materials (
MARA
). - Secondary list (Level 2): When user clicks on a material, show its plant-specific details (
MARC
).
*&---------------------------------------------------------------------*
*& Report ZTEST_PROGRAM_2
*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*
REPORT ztest_program_2.
TABLES: mara, marc.
DATA: it_mara TYPE TABLE OF mara,
it_marc TYPE TABLE OF marc.
"--- Fetch data
SELECT matnr mtart FROM mara UP TO 20 ROWS INTO TABLE it_mara.
"--- Event: START-OF-SELECTION -> Display Basic List
START-OF-SELECTION.
WRITE: / 'Material No.', 15 'Material Type'.
ULINE.
LOOP AT it_mara INTO DATA(wa_mara).
WRITE: / wa_mara-matnr, 15 wa_mara-mtart.
HIDE wa_mara-matnr. "Hide material no for later use
ENDLOOP.
"--- Event: AT LINE-SELECTION -> Drill down to details
AT LINE-SELECTION.
CLEAR it_marc.
SELECT matnr werks dismm
FROM marc
INTO TABLE it_marc
WHERE matnr = sy-lisel+0(18). " Material from selected line
IF sy-subrc = 0.
NEW-PAGE.
WRITE: / 'Material:', sy-lisel+0(18).
ULINE.
WRITE: / 'Plant', 15 'MRP Type'.
ULINE.
LOOP AT it_marc INTO DATA(wa_marc).
WRITE: / wa_marc-werks, 15 wa_marc-dismm.
ENDLOOP.
ELSE.
MESSAGE 'No plant data found for this material' TYPE 'I'.
ENDIF.
Output :