ALV Reports Part 5: Layout, Sort, Filter, Totals and Variants
Preview · a free account unlocks the full lesson
Control how an ALV opens: layout options, default sort with subtotals, pre-set filters, totals-only views, and user layout variants (DISVARIANT, i save, default variant on the selection screen with F4 help).
In this lessonShow sectionsHide sections
Visual overview
Explanation
Parts 1 through 4 covered displaying data in an ALV; this lesson is about controlling the initial view and letting users keep their own. Default sort order and subtotals come from a sort table — lvc_t_sort or slis_t_sortinfo_alv — with subtot = 'X' marking where subtotals appear.
Filters can be pre-set using lvc_t_filt, and totals need either do_sum set in the field catalog or a sort entry with a subtotal attached. Layout variants, built around the DISVARIANT structure, let users save their own column order, sorts, and filters, and setting i_save = 'A' allows both user-specific and global variants to be saved.
One thing worth keeping in mind: hard-coding a sort order that users keep changing anyway is worse than simply letting them save their own default variant.
On the layout settings themselves (LVC_S_LAYO or SLIS_LAYOUT_ALV): zebra and cwidth_opt improve readability through striping and optimized column widths; totals_bef shows totals above the data rather than below; no_totline hides the total line entirely; sel_mode controls the selection mode; and grid_title puts a title above the grid.
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
Referenced SAP objects
Reviewed reference pages for the objects this page mentions.
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.