0

I have an ALV grid where I need the default display to change between four different views based on the inputs and and the button selected. The difference between the inputs is a certain data type that is specific to my business. There are two different buttons, one which displays all columns, one which only displays some of the columns.

I know that default displays can be set on the ALV page itself. I have done this, but this will save the display for one of my data types, and then when the other data type is entered, the ALV grid still has the other layout.

Is there a way to hard code which default to use? I am preparing the columns of the ALV grid in a perform, I would like to just be able to select a default display within that perform, but I am not sure how to go about this or if it is even possible.

Thanks,

Sandra Rossi
  • 11,934
  • 5
  • 22
  • 48
Evan Lalo
  • 1,209
  • 1
  • 14
  • 34
  • 1
    Yes, there is. Which ALV method are you using? FM based or Class based? If class based, which class? – Bryan Cain Jun 12 '17 at 15:14
  • Class based. I ended up just giving the two different data types the same name and then looping through the table and replacing them as needed. Thanks for commenting though! – Evan Lalo Jun 12 '17 at 15:17

1 Answers1

1

Use the layout key information (SALV_S_LAYOUT_KEY for CL_SALV_TABLE, obtained via the layout object - similar stuff exists for CL_GUI_ALV_GRID, search for DISVARIANT) to specify different handles depending on the buttons selected. This will allow for the user to save different layout variants for either list type and specify different default layouts.

vwegert
  • 18,371
  • 3
  • 37
  • 55