ALV
Expand and Collapse Detail Lines in SAP ALV via ABAP
This article demonstrates how to dynamically expand and collapse additional detail information within the SAP ALV. The solution focuses on a practical ABAP implementation featuring intuitive user guidance and manageable grid interactions.
Initial Question and Solution Strategy
- Are there already standard demo or production programs within SAP that utilize this feature?
- Yes, you can find this functionality active inside transaction ME2ON.
- Can the functionality be directly copied and reused from these standard SAP programs?
- No, because the modern MM transactions leverage a complex program workflow. The feature is not executed natively by the ALV grid component itself, but rather by leaving and re-calling the underlying dynpro screen.
How the Solution Operates within the ALV Grid
To support this interaction, I integrated a button component combined with a hotspot configuration into a dedicated column.
The ALV application toolbar also features two distinct buttons to either expand or collapse all details with a single interaction. When the expand command is triggered, the detailed datasets for all rows configured with an expand button are inserted directly beneath each respective line, followed by an immediate ALV grid refresh.
Download Source Code on GitHub
Select the appropriate variant matching your SAP release version.
| Technology | Minimum Release | GitHub |
|---|---|---|
cl_salv_table |
SAP_BASIS 702 | Open Repository |
cl_salv_table |
SAP_BASIS 740SP02 | Open Repository |
cl_salv_table |
SAP_BASIS 740SP08 | Open Repository |
cl_gui_alv_grid |
SAP_BASIS 702 | Open Repository |
cl_gui_alv_grid |
SAP_BASIS 740SP02 | Open Repository |
cl_gui_alv_grid |
SAP_BASIS 740SP08 | Open Repository |
Import GitHub Repo via abapGit
You can also import the source code directly into your system using abapGit. You can find a step-by-step guide for importing from a GitHub repository in the linked blog post.
Open instructions for importing with abapGit
Repository URLs zum Kopieren
https://github.com/stekoester/exp_col_in_salv
https://github.com/stekoester/exp_col_in_alv