ALV Reports Part 2: Quick ALV with CL_SALV_TABLE
Preview · a free account unlocks the full lesson
Use the SALV object model: cl salv table= factory, functions (toolbar), columns (texts, hiding, optimizing), display settings, aggregations and layout saving — with error handling for CX SALV MSG and CX SALV NOT FOUND.
In this lessonShow sectionsHide sections
Visual overview
Explanation
Part 1 used the classic function module for building an ALV; SALV is the simpler object-oriented alternative for display-only reports, and it's widely used across both ECC 6.0 and S/4HANA on-premise. CL_SALV_TABLE lets you create a full ALV in just a few lines: call cl_salv_table=>factory( ... ) and then ->display( ).
Its field catalog is derived automatically from the internal table's own types, with DDIC data elements supplying the column labels. All of its settings are exposed as objects, reached through get_functions( ), get_columns( ), get_aggregations( ), get_layout( ), and get_display_settings( ).
One limit to keep in mind: CL_SALV_TABLE is display-only, so for an editable grid you need CL_GUI_ALV_GRID instead, which Part 9 covers.
The factory call itself looks like cl_salv_table=>factory( IMPORTING r_salv_table = go_alv CHANGING t_table = gt_out ). Note that t_table is CHANGING, so you should pass a global or otherwise long-lived table, since the ALV keeps a reference to it rather than copying it. The call can raise CX_SALV_MSG, so always wrap it in TRY/CATCH. Optional parameters include list_display = abap_true for a classic list-style display, and r_container to display the ALV inside a specific screen container instead of full-screen.
Create a free account to keep reading
You have read the opening of this lesson. A free ERPClimb account unlocks the rest of it, every other lesson and topic, and your learning history, so you can pick up exactly where you stopped. No card needed.
- Full explanation
- Code example
- Real project scenario
- Common mistakes
- Best practices
- Interview angle
One tap with Google works too. Every topic keeps its first lesson open to everyone.
Keep exploring
Interview questions on this topic
Related SAP topics
Check before use: lesson examples are educational, not a guarantee of correctness for your SAP edition or release. Sample code has not been executed on your SAP system. Confirm API availability, syntax, authorizations and business impact in an approved development or test environment.