ALV Reports
ABAP Developmentintermediate

CL_SALV_TABLE Basics

Displaying an internal table with the modern ALV API.

Explanation

CL_SALV_TABLE=>FACTORY builds a grid from an internal table with minimal code. Column customisation (short/medium/long text, hotspots, colours) happens via GET_COLUMNS. Layout variants let end users save preferred column sets. For editable grids fall back to CL_GUI_ALV_GRID.

Code example

ABAP Code
cl_salv_table=>factory(  IMPORTING r_salv_table = DATA(lo_alv)  CHANGING  t_table      = lt_data ).lo_alv->get_columns( )->set_optimize( abap_true ).lo_alv->display( ).

Real project scenario

A finance report needed drill-down to FBL5N. Adding a hotspot on KUNNR and reacting to the LINK_CLICK event delivered it in a day.

Common mistakes

Using CL_GUI_ALV_GRID when read-only would do; forgetting SET_SCREEN_STATUS for standard GUI buttons; not registering event handlers before DISPLAY.

Best practices

Prefer CL_SALV_TABLE for read-only; use layout variants; enable ALV toolbar F1 help by binding to data dictionary types.

Interview angle

Difference between CL_SALV_TABLE and CL_GUI_ALV_GRID and when to pick each.