ALV Reports
ABAP Developmentbeginner

ALV Reports Part 1: ALV Basics with REUSE_ALV_GRID_DISPLAY

Key takeaway

Build your first ALV report the classic way: read flight data, build a field catalog with REUSE ALV FIELDCATALOG MERGE or by hand, set a layout and display it with REUSE ALV GRID DISPLAY — and see how the three ALV technologies compare.

What this complete series covers

Learn ALV Reports in a clear, practical sequence — from the basic idea to real project use, troubleshooting, and interview-ready understanding.

Who it is for
Best for SAP consultants, developers, and learners who want a practical understanding of ALV Reports.
Prerequisites
Basic SAP navigation and ABAP syntax help. For hands-on practice, use an ABAP system with ADT or the relevant ABAP development tools.
Final outcome
By the end, you should be able to explain ALV Reports clearly, follow the main end-to-end flow, apply it in a project scenario, and troubleshoot the most common issues.
  1. Part 1: ALV Reports Part 1: ALV Basics with REUSE_ALV_GRID_DISPLAY

    Structure ALV reports into explicit stages—input validation, authorized data retrieval, business processing and presentation—so SQL, rules and UI code remain independently testable.

  2. Part 2: ALV Reports Part 2: Quick ALV with CL_SALV_TABLE

    Use CLSALVTABLE for fast, maintainable read-only ALV reporting, and choose CLGUIALVGRID only when you genuinely need editing or lower-level control.

  3. Part 3: ALV Reports Part 3: OO ALV with CL_GUI_ALV_GRID and a Custom Container

    Build interactive ALV deliberately with hotspots, events, F4/help and navigation while keeping business actions secure and independent from frontend display code.

  4. Part 4: ALV Reports Part 4: The Field Catalog in Depth

    Configure ALV columns as a presentation layer: use business-friendly labels, DDIC semantics, visibility, formatting and technical-column control without embedding business rules in display metadata.

  5. Part 5: ALV Reports Part 5: Layout, Sort, Filter, Totals and Variants

    Use ALV built-in sorting, filtering, aggregation and subtotal features instead of custom calculation code, while preserving currency and unit semantics so totals remain meaningful.

  6. Part 6: ALV Reports Part 6: Hotspot and Double-Click Drill-Down

    Implement ALV hotspots and drill-down navigation as thin UI actions that pass a stable business key to a dedicated navigation or service layer rather than embedding transaction logic in event handlers.

  7. Part 7: ALV Reports Part 7: Colors, Icons and Traffic Lights

    Use ALV color, icon and traffic-light indicators to communicate status visually without making formatting the only source of meaning or business logic.

  8. Part 8: ALV Reports Part 8: Toolbar Buttons, PF-STATUS and User Commands

    Handle ALV user actions through thin event handlers that validate the selected context and delegate navigation or business operations to reusable services with backend authorization.

  9. Part 9: ALV Reports Part 9: Editable ALV with CL_GUI_ALV_GRID

    Save editable ALV changes safely by synchronizing frontend edits, validating only changed rows, enforcing authorization and locking, and persisting through a controlled business transaction.

  10. Part 10: ALV Reports Part 10: Authorization and Sensitive Data in ALV Reports

    Protect custom ALV reports with backend authorization before sensitive data is selected or actions are executed, and never rely on hidden columns or buttons as a security boundary.

System and release assumptions: Examples follow modern ABAP practices. Exact syntax, available APIs, and tools can vary by SAP release, so release-dependent points are called out where needed.

Explanation

📌 KEY POINTS
✅ ALV (ABAP List Viewer) gives users sorting, filtering, totals, layouts and Excel export for free.

✅ Classic function module REUSE_ALV_GRID_DISPLAY is still found in most ECC and S/4 on-premise reports.

✅ Three technologies: REUSE_ALV_* FMs (classic), CL_GUI_ALV_GRID (OO with container), CL_SALV_TABLE (simple OO).

⚠️ The field catalog must match the output table's field names exactly (uppercase), or columns are missing.

━━━━━━━━━━━━━━━━━━━━
▶ WHAT THIS SERIES COVERS

  • Part 1 — ALV basics with REUSE_ALV_GRID_DISPLAY (this lesson)
  • Part 2 — CL_SALV_TABLE
  • Part 3 — OO ALV with CL_GUI_ALV_GRID and a custom container
  • Part 4 — field catalog in depth
  • Part 5 — layout, sort, filter, totals and variants
  • Part 6 — hotspot and double-click drill-down
  • Part 7 — colors, icons and traffic lights
  • Part 8 — toolbar, PF-STATUS and user commands
  • Part 9 — editable ALV
  • Part 10 — authorization and sensitive data

━━━━━━━━━━━━━━━━━━━━
▶ 1. WHY ALV INSTEAD OF WRITE

A WRITE list has fixed columns and no interactivity. An ALV grid lets users sort, filter, hide columns, total amounts, save layouts and export — with no extra code.

━━━━━━━━━━━━━━━━━━━━
▶ 2. THE THREE ALV TECHNOLOGIES

  • REUSE_ALV_GRID_DISPLAY / REUSE_ALV_LIST_DISPLAY — function modules, SLIS types (slis_t_fieldcat_alv). Quick; no screen needed. Most legacy reports.
  • CL_GUI_ALV_GRID — control in a custom container on your own screen (dynpro). Full control, events, editing.
  • CL_SALV_TABLE — object model, full screen or container, very little code; not editable in the standard way.

━━━━━━━━━━━━━━━━━━━━
▶ 3. STEPS OF A CLASSIC ALV REPORT

  1. Define an output structure/table (TYPES + internal table).
  2. Select data into it.
  3. Build the field catalog (automatic from DDIC, manual, or both).
  4. Set the layout (zebra, optimize column width).
  5. Call REUSE_ALV_GRID_DISPLAY with the program name, field catalog, layout and output table.

━━━━━━━━━━━━━━━━━━━━
▶ 4. FIELD CATALOG OPTIONS

  • REUSE_ALV_FIELDCATALOG_MERGE with a dictionary structure (i_structure_name = 'SFLIGHT') — labels and types come from DDIC.
  • Manual: fill slis_fieldcat_alv entries (fieldname, seltext_m, outputlen, do_sum …).
  • Common approach: merge from DDIC, then adjust columns in a loop.

━━━━━━━━━━━━━━━━━━━━
▶ 5. LAYOUT

slis_layout_alv: zebra = 'X', colwidth_optimize = 'X', window_titlebar. Allow user layouts with i_save = 'A' and a variant.

━━━━━━━━━━━━━━━━━━━━
▶ STEP BY STEP

  1. Create report ZALV_FLIGHTS_CLASSIC with the code example.
  2. Run it and try sorting, filtering, totals and export.
  3. Save a layout (i_save = 'A') and reuse it.
  4. Remove a column from the field catalog and see it disappear.

💡 Modern: for simple display-only reports, CL_SALV_TABLE (Part 2) needs less code; in S/4HANA new UIs are Fiori, but ALV remains standard for SAP GUI reports.

✅ CHECKPOINT: you can build a classic ALV report with a field catalog and layout.

Code example

ABAP Code
REPORT zalv_flights_classic. TYPE-POOLS slis.                                   " needed in older releases * ===== Step 1: output structure and table =====TYPES: BEGIN OF ty_out,         carrid   TYPE s_carr_id,         connid   TYPE s_conn_id,         fldate   TYPE s_date,         price    TYPE s_price,         currency TYPE s_currcode,         seatsmax TYPE s_seatsmax,         seatsocc TYPE s_seatsocc,       END OF ty_out. DATA: gt_out      TYPE STANDARD TABLE OF ty_out,      gt_fieldcat TYPE slis_t_fieldcat_alv,      gs_fieldcat TYPE slis_fieldcat_alv,      gs_layout   TYPE slis_layout_alv,      gv_repid    TYPE sy-repid. PARAMETERS p_carr TYPE s_carr_id DEFAULT 'LH'. START-OF-SELECTION.* ===== Step 2: read data =====  SELECT carrid connid fldate price currency seatsmax seatsocc    FROM sflight INTO TABLE gt_out    WHERE carrid = p_carr.  IF gt_out IS INITIAL.    MESSAGE 'No data found' TYPE 'S' DISPLAY LIKE 'E'.    RETURN.  ENDIF. * ===== Step 3: field catalog - one entry per column =====  PERFORM add_field USING 'CARRID'   'Airline'     ' '.  PERFORM add_field USING 'CONNID'   'Connection'  ' '.  PERFORM add_field USING 'FLDATE'   'Flight date' ' '.  PERFORM add_field USING 'PRICE'    'Price'       'X'.     " X = total this column  PERFORM add_field USING 'CURRENCY' 'Currency'    ' '.  PERFORM add_field USING 'SEATSMAX' 'Capacity'    'X'.  PERFORM add_field USING 'SEATSOCC' 'Occupied'    'X'. * ===== Step 4: layout =====  gs_layout-zebra             = 'X'.  gs_layout-colwidth_optimize = 'X'.  gs_layout-window_titlebar   = 'Flights'. * ===== Step 5: display =====  gv_repid = sy-repid.  CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'    EXPORTING      i_callback_program = gv_repid      is_layout          = gs_layout      it_fieldcat        = gt_fieldcat      i_save             = 'A'                  " user may save layouts    TABLES      t_outtab           = gt_out    EXCEPTIONS      program_error      = 1      OTHERS             = 2.  IF sy-subrc <> 0.    MESSAGE 'ALV display failed' TYPE 'E'.  ENDIF. *----------------------------------------------------------------------*FORM add_field USING iv_field TYPE slis_fieldname                     iv_text  TYPE c                     iv_sum   TYPE c.  CLEAR gs_fieldcat.  gs_fieldcat-fieldname = iv_field.           " must match ty_out field (uppercase)  gs_fieldcat-seltext_m = iv_text.  gs_fieldcat-do_sum    = iv_sum.  IF iv_field = 'PRICE'.    gs_fieldcat-cfieldname = 'CURRENCY'.      " amount formatted by currency  ENDIF.  APPEND gs_fieldcat TO gt_fieldcat.ENDFORM. * Alternative: DDIC-based catalog* CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'*   EXPORTING i_structure_name = 'SFLIGHT'*   CHANGING  ct_fieldcat      = gt_fieldcat.

Real project scenario

A finance team received a WRITE-based open items report every week and re-typed the figures into Excel to sort and subtotal by company code. Converting the report to REUSE_ALV_GRID_DISPLAY with DO_SUM on amounts and a saved user layout removed the manual work entirely.
Later, a column went missing after a developer renamed a field in the output structure but not in the field catalog. The team added a rule: build the catalog from the output structure (merge) and only adjust labels manually.

Common mistakes

  • Field catalog names not matching the output table fields (case sensitive, uppercase).
  • Missing cfieldname for amounts, so currency formatting is wrong.
  • Passing sy-repid directly instead of a variable to i_callback_program.
  • No handling of empty result sets.
  • Duplicating the full field catalog manually when DDIC merge would do.

Best practices

  • Use a dedicated output structure for the ALV.
  • Build the catalog from DDIC and adjust only what is needed.
  • Link amounts to currency and quantities to units.
  • Allow saved layouts (i_save = 'A').
  • Consider CL_SALV_TABLE for new display-only reports.

Interview angle

Questions: "Which ALV technologies do you know?", "What is a field catalog?", "How do you get totals in ALV?"
Strong answer: REUSE_ALV_GRID_DISPLAY (FM, SLIS types), CL_GUI_ALV_GRID (OO in container, events, editing), CL_SALV_TABLE (simple OO); the field catalog describes each column (fieldname, texts, output length, do_sum, cfieldname); built via FIELDCATALOG_MERGE/LVC_FIELDCATALOG_MERGE or manually; totals via do_sum or user action; layouts saved with i_save.

Practice this lesson

Quick check

1. Which ALV technology is a function module using SLIS types and needs no own screen?

2. In a well-structured ALV report, where should the SELECT statements be executed?

3. When building a classic ALV list with REUSE_ALV_GRID_DISPLAY, which function module is typically used to automatically generate the field catalog from a Dictionary structure?

Interview questions

1. Describe the recommended sequence of steps or stages for processing data within a maintainable ALV report. Why is structuring the report in this way considered a best practice?

Answer it in your own words first, then compare.

2. A finance ALV report selects data inside the display routine and mixes reconciliation logic with field catalog code. How would you structure it?

Answer it in your own words first, then compare.

Practice more with Interview AI →

Reference-verified: the steps are checked against official SAP documentation and tutorials, and object and field names in the sample code are checked for consistency. The code has not been compiled or run on an SAP system by ERPClimb. Syntax marked release-dependent varies by SAP release, so check it in your own system.

More lessons in this topic

Interview questions on this topic

Related SAP topics