Save layout ALV button missing

If you have implemented your SAP ALV report and all works fine apart from the Save layout ALV button, you can set filters to hide columns etc but you are unable to save this layout as a variant for future use. The solution is very simple you have probably only missed out one line of code!!

My example used the ALV OO concept but will be the same solution for all ALV reports. Does you code look like this?

CALL METHOD mygrid->set_table_for_first_display
is_variant = wa_variant
i_save = 'A'
is_layout = wa_layout
it_toolbar_excluding = it_excl
it_outtab = it_report[] it_fieldcatalog = it_fieldcat[] it_sort = it_sortcat
invalid_parameter_combination = 1
program_error = 2
too_many_lines = 3

All you need to do is add the following line of ABAP code above the “set_table_for_first_display” method call:

wa_variant-report = sy-repid.

About the Author se80