2007 Feb 21 5:58 PM
Afternoon,
I have created a ALV grid. When the ALV grid is displayed for the first time using the method SET_TABLE_FOR_FIRST_DISPLAY the default layout is used. However when the grid is refreshed the default layout is lost. How can I ensure that the default layout is always displayed until the user selects a different one. If the user does select a different layout how can I ensure that this layout is always displayed until the users chooses a different one or the user exits the program.
Thanks and regards
John.
2007 Feb 21 6:10 PM
Hi,
You have to save layout as variant.
Check this code for reference -
data: variant type disvariant.
variant-report = sy-repid.
variant-username = sy-uname.
CALL METHOD GR_ALVGRID->SET_TABLE_FOR_FIRST_DISPLAY
EXPORTING
IT_TOOLBAR_EXCLUDING = GT_EXCLUDE
IS_LAYOUT = GS_LAYOUT
<b>IS_VARIANT = VARIANT</b>
I_SAVE = 'A'
CHANGING
IT_FIELDCATALOG = GT_FIELDCAT
IT_OUTTAB = ITAB.
Regards,
Amit
Reward all helpful replies.
Afternoon,
I have created a ALV grid. When the ALV grid is displayed for the first time using the method SET_TABLE_FOR_FIRST_DISPLAY the default layout is used. However when the grid is refreshed the default layout is lost. How can I ensure that the default layout is always displayed until the user selects a different one. If the user does select a different layout how can I ensure that this layout is always displayed until the users chooses a different one or the user exits the program.
Thanks and regards
John.
2007 Feb 21 6:10 PM
Hi,
You have to save layout as variant.
Check this code for reference -
data: variant type disvariant.
variant-report = sy-repid.
variant-username = sy-uname.
CALL METHOD GR_ALVGRID->SET_TABLE_FOR_FIRST_DISPLAY
EXPORTING
IT_TOOLBAR_EXCLUDING = GT_EXCLUDE
IS_LAYOUT = GS_LAYOUT
<b>IS_VARIANT = VARIANT</b>
I_SAVE = 'A'
CHANGING
IT_FIELDCATALOG = GT_FIELDCAT
IT_OUTTAB = ITAB.
Regards,
Amit
Reward all helpful replies.
2007 Feb 26 8:31 AM
Amit,
Thanks for your comments. I have found that if you change the layout of an ALV grid (e.g. by making some fields editable) you cannot use Refresh Display to update the grid with the revised layout. However, you can use set_table_for_first_display.
Thanks
John.
2007 Feb 26 8:32 AM
If the layout of a grid is changed you must use set_table_for_first_display to reflect that change.