Application Development 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: 

layout option in selection screen

Former Member
0 Kudos
1,421

Hi all,

I am creating an alv using oops. I have a requirement that I have to create a parameter for layout in selection screen and when user press f4 help for that parameter then allthe custom layouts should come in the popup and grid layout should display as per the layout selected by user from that popup.

Can anybody help me out?

Regards,

Azra.

1 ACCEPTED SOLUTION

Former Member
0 Kudos
243

See example in SAP standard program BCALV_GRID_09.

To do this use the parameters IS_VARIANT and I_SAVE of the set_table_for_first_display method. Note that the IS_VARIANT parameter must have the structure DISVARIANT.

The I_SAVE "Options for saving layouts" parameter can have the following values:

U Only user specific layouts can be saved

X Only global layouts can be saved

A Both user specific and global layouts can be saved

Space Layouts can not be saved

Add the following code to the example:

FORM load_data_into_grid.

DATA:

  • For parameter IS_VARIANT

l_layout TYPE disvariant.

Code..........

  • Load data into the grid and display them

l_layout-report = sy-repid.

CALL METHOD go_grid->set_table_for_first_display

EXPORTING i_structure_name = 'SFLIGHT'

is_variant = l_layout

i_save = 'A'

CHANGING it_outtab = gi_

use FM LVC_VARIANT_F4 for input help of variant

1 REPLY 1

Former Member
0 Kudos
244

See example in SAP standard program BCALV_GRID_09.

To do this use the parameters IS_VARIANT and I_SAVE of the set_table_for_first_display method. Note that the IS_VARIANT parameter must have the structure DISVARIANT.

The I_SAVE "Options for saving layouts" parameter can have the following values:

U Only user specific layouts can be saved

X Only global layouts can be saved

A Both user specific and global layouts can be saved

Space Layouts can not be saved

Add the following code to the example:

FORM load_data_into_grid.

DATA:

  • For parameter IS_VARIANT

l_layout TYPE disvariant.

Code..........

  • Load data into the grid and display them

l_layout-report = sy-repid.

CALL METHOD go_grid->set_table_for_first_display

EXPORTING i_structure_name = 'SFLIGHT'

is_variant = l_layout

i_save = 'A'

CHANGING it_outtab = gi_

use FM LVC_VARIANT_F4 for input help of variant