SAP ALV Reports — Interactive Reporting Guide
In this tutorial, you'll learn about SAP ALV Reports. We cover key concepts, practical examples, and best practices.
SAP ALV (ABAP List Viewer) is the standard reporting framework in SAP that converts internal tables into interactive, sortable, filterable reports with export capabilities and user interaction events.
What You'll Learn
You will learn to create ALV reports using REUSE_ALV_GRID_DISPLAY, build field catalogs, handle interactive events (double-click, hot spots), implement sorting and filtering, and use the ALV Object Model for modern ABAP.
Why It Matters
Before ALV, SAP reports were plain text output using WRITE statements — no sorting, no filtering, no export. ALV gives users full control: sort by any column, filter rows, choose columns, export to Excel, and double-click to drill into details.
Real-World Use
A financial controller runs an ALV report showing all vendor open items. She sorts by overdue days, filters to show only amounts >$10,000, exports the result to Excel for the audit team, and double-clicks a vendor to see line-item details — all without writing additional code.
Learning Path
flowchart LR A["SAP ABAP"] --> B["ABAP Objects"] B --> C["SAP ALV
You are here"] C --> D["SAP Workflow"] D --> E["SAP CPI"] style C fill:#f90,color:#fff
ALV Architecture
flowchart TD A["Internal Table
(Data)"] --> B["Field Catalog
(Structure)"] B --> C["ALV Grid"] C --> D["User Interaction"] D --> E{"Event Type"} E -->|"Double-Click"| F["USER_COMMAND"] E -->|"Sort/Filter"| G["Automatic
ALV Handling"] E -->|"Hotspot Click"| H["Drill Down"] E -->|"Export"| I["Excel / CSV"]
Classic ALV: REUSE_ALV_GRID_DISPLAY
Basic Report
REPORT Z_ALV_SIMPLE.
TYPES: BEGIN OF ty_data,
matnr TYPE mara-matnr,
maktx TYPE makt-maktx,
meins TYPE mara-meins,
brgew TYPE mara-brgew,
END OF ty_data.
DATA: gt_data TYPE TABLE OF ty_data.
START-OF-SELECTION.
SELECT a~matnr, b~maktx, a~meins, a~brgew
FROM mara AS a
INNER JOIN makt AS b ON a~matnr = b~matnr
INTO TABLE @gt_data
UP TO 100 ROWS
WHERE b~spras = 'E'.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_structure_name = 'TY_DATA'
TABLES
t_outtab = gt_data.
Expected output: A grid with columns Material, Description, UoM, Gross Weight. Users can sort, filter, and resize columns.
Field Catalog
The field catalog gives you precise control over column properties:
DATA: lt_fieldcat TYPE slis_t_fieldcat_alv.
PERFORM build_fieldcat.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
it_fieldcat = lt_fieldcat
TABLES
t_outtab = gt_data.
FORM build_fieldcat.
DATA: ls_fieldcat TYPE slis_fieldcat_alv.
ls_fieldcat-fieldname = 'MATNR'.
ls_fieldcat-seltext_m = 'Material'.
ls_fieldcat-outputlen = 18.
ls_fieldcat-hotspot = 'X'.
APPEND ls_fieldcat TO lt_fieldcat.
ls_fieldcat-fieldname = 'MAKTX'.
ls_fieldcat-seltext_m = 'Description'.
ls_fieldcat-outputlen = 40.
APPEND ls_fieldcat TO lt_fieldcat.
ls_fieldcat-fieldname = 'BRGEW'.
ls_fieldcat-seltext_m = 'Weight'.
ls_fieldcat-outputlen = 12.
ls_fieldcat-dozw = 'X'. " Display zero as empty
APPEND ls_fieldcat TO lt_fieldcat.
ENDFORM.
Interactive Events
ALV makes reports interactive through events:
DATA: ls_events TYPE slis_alv_event,
lt_events TYPE slis_t_event.
ls_events-name = slis_ev_user_command.
ls_events-form = 'USER_COMMAND'.
APPEND ls_events TO lt_events.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
it_fieldcat = lt_fieldcat
i_callback_program = sy-repid
it_events = lt_events
TABLES
t_outtab = gt_data.
FORM user_command USING r_ucomm LIKE sy-ucomm
rs_selfield TYPE slis_selfield.
CASE r_ucomm.
WHEN '&IC1'. " Double-click
READ TABLE gt_data INTO gs_data INDEX rs_selfield-tabindex.
IF sy-subrc = 0.
SET PARAMETER ID 'MAT' FIELD gs_data-matnr.
CALL TRANSACTION 'MM03' AND SKIP FIRST SCREEN.
ENDIF.
ENDCASE.
ENDFORM.
ALV Object Model (Modern)
For ABAP Objects, use the ALV Grid class CL_GUI_ALV_GRID:
CLASS zcl_report_alv DEFINITION.
PUBLIC SECTION.
METHODS: display.
PRIVATE SECTION.
DATA: mo_grid TYPE REF TO cl_gui_alv_grid,
mt_data TYPE TABLE OF ty_data.
ENDCLASS.
CLASS zcl_report_alv IMPLEMENTATION.
METHOD display.
CREATE OBJECT mo_grid
EXPORTING
i_parent = cl_gui_container=>screen0.
mo_grid->set_table_for_first_display(
EXPORTING
i_structure_name = 'TY_DATA'
CHANGING
it_outtab = mt_data ).
ENDMETHOD.
ENDCLASS.
Layout Settings
ALV reports look professional with custom layouts:
DATA: ls_layout TYPE slis_layout_alv.
ls_layout-zebra = 'X'. " Alternating row colors
ls_layout-colwidth_optimize = 'X'.
ls_layout-no_colhead = ' '.
ls_layout-box_fieldname = 'SEL'. " Checkbox column
ls_layout-info_fieldname = 'LINE_COLOR'.
Real-World Scenario: Inventory Report
A logistics manager needs an inventory report showing stock levels across plants with interactive drill-down:
- Report displays all materials with plant, stock quantity, and value
- Manager sorts by "stock value" descending — finds highest-value items
- Manager filters "Stock < 0" to find materials with negative stock
- Manager double-clicks a material → navigates to MM03 (material master)
- Manager clicks hotspot on plant → shows stock by storage location
- Manager exports to Excel for monthly inventory meeting
Common Errors
1. Field Catalog Missing or Incomplete
Without a field catalog, ALV may not display at all. Always provide it_fieldcat or i_structure_name.
2. Event Handler Not Registered
Interactive events (double-click) do not fire unless the FORM is registered in it_events. Check the event table.
3. Grid Container Not Initialized
For OO ALV, a container (cl_gui_custom_container or cl_gui_container=>screen0) must exist before creating cl_gui_alv_grid.
4. Internal Table Empty
If t_outtab has zero rows, ALV shows an empty grid. Check the SELECT statement and ensure data exists.
5. Hotspot Not Working
Hotspot click requires the hotspot field in the field catalog set to 'X' and the event registered.
6. ALV Freeze on Large Data
Displaying 500,000+ rows in ALV freezes the SAP GUI. Use a maximum row limit or paging.
Practice Questions
What does ALV stand for? ABAP List Viewer — SAP's interactive reporting framework.
What function module is used for classic ALV reports? REUSE_ALV_GRID_DISPLAY — the most common ALV function module.
What is the field catalog in ALV? A table defining column properties — field name, label, width, hotspot, and editability.
How do you handle double-click in ALV? Register the event
USER_COMMANDand check for&IC1(interactive click 1).What is the difference between classic ALV and OO ALV? Classic ALV uses function modules (REUSE_ALV_GRID_DISPLAY). OO ALV uses class
CL_GUI_ALV_GRIDfor more flexibility.
Challenge: Build an ALV report showing sales order data (VBAP table) with interactive drill-down: double-click an order to show line items, and double-click a line item to show delivery details. Include hotspot fields, checkboxes for batch processing, and Excel export.
FAQ
What's Next
| Tutorial | What You'll Learn |
|---|---|
| SAP ABAP Programming | Core ABAP skills for building reports |
| SAP ABAP Objects | Object-oriented techniques for advanced ALV customization |
Built by the developers of Doda Browser, DodaZIP, and Durga Antivirus Pro. Updated 2026-06-24.
Built by the developers of DodaTech
Doda Browser, DodaZIP & Durga Antivirus Pro