Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

ALV Grid save layout

Former Member
0 Likes
789

Hi all,

in a programm there is a ALV grid of type cl_gui_alv_grid.

When I run the programm, I can change the layout (hide columns etc) but I can't

save the changes I make. What do I have to do to activate the saving of the layout?

Which field do I have to set to activate it or what can already be set which disables the showing of the save possibility?

Greetings Fred.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
564

Hi Fred

U need to transfer the name of the report and the user to the grid class in order to allow to save the layout:

DATA: LT_VARIANT  TYPE DISVARIANT.

LT_VARIANT-REPORT   = SY-REPID.
LT_VARIANT-USERNAME = SY-UNAME.

CALL METHOD ALV_GRID->SET_TABLE_FOR_FIRST_DISPLAY
       EXPORTING 
                 IS_VARIANT                      = LT_VARIANT
                 I_SAVE                             = 'A'
                 IS_LAYOUT                       = LT_LAYOUT
                 IT_TOOLBAR_EXCLUDING = GT_NO_CODES
       CHANGING  
                 IT_OUTTAB                  = T_OUTPUT
                 IT_FIELDCATALOG      = GT_FIELDCAT.

The user has to have the authorizations to manage the layout.

Max

3 REPLIES 3
Read only

Former Member
0 Likes
565

Hi Fred

U need to transfer the name of the report and the user to the grid class in order to allow to save the layout:

DATA: LT_VARIANT  TYPE DISVARIANT.

LT_VARIANT-REPORT   = SY-REPID.
LT_VARIANT-USERNAME = SY-UNAME.

CALL METHOD ALV_GRID->SET_TABLE_FOR_FIRST_DISPLAY
       EXPORTING 
                 IS_VARIANT                      = LT_VARIANT
                 I_SAVE                             = 'A'
                 IS_LAYOUT                       = LT_LAYOUT
                 IT_TOOLBAR_EXCLUDING = GT_NO_CODES
       CHANGING  
                 IT_OUTTAB                  = T_OUTPUT
                 IT_FIELDCATALOG      = GT_FIELDCAT.

The user has to have the authorizations to manage the layout.

Max

Read only

0 Likes
564

Hi Max,

thank you very much!

I already tried the i_save = 'A', but there was no variant, now it works!

Greetings Fred.

Read only

Former Member