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

cl_gui_alv_grid save layout problem

Former Member
0 Likes
9,641

Hello all,

I have a screen in wich i have a custom container for an ALV.

When running the method set_table_for_first_display i am sending the parameter I_SAVE as 'A'.

The problem is that it is not showing the save layout button.

Does anyone have any idea why could this be?

Thank you

Nuno Silva

1 ACCEPTED SOLUTION
Read only

former_member194669
Active Contributor
4,029

Try to pass


    gs_variant-report       = sy-repid.
    gs_variant-username     = sy-uname.

then


    call method grid1->set_table_for_first_display
      exporting
        is_layout                     = gs_layout
        is_variant                    = gs_variant
        i_save                        = 'A'

a®

2 REPLIES 2
Read only

former_member194669
Active Contributor
4,030

Try to pass


    gs_variant-report       = sy-repid.
    gs_variant-username     = sy-uname.

then


    call method grid1->set_table_for_first_display
      exporting
        is_layout                     = gs_layout
        is_variant                    = gs_variant
        i_save                        = 'A'

a®

Read only

Former Member
4,029

Hi,

you need to supply the is_variant as well

DATA : gs_variant TYPE disvariant,

gs_variant-report = sy-repid.

CALL METHOD obj_grid0->set_table_for_first_display

EXPORTING

is_layout = ds_layo

is_variant = gs_variant

i_save = 'A'

CHANGING

it_outtab = t_final[]

it_fieldcatalog = t_fcat.

if you are using a layout selection on the selection screen. Than you might need to do the coding for its F4 selection.

For e.g.

AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_layout.

PERFORM f4_for_variant.

FORM f4_for_variant .

DATA: fl_exit(1) TYPE c.

gs_variant-report = sy-repid.

CALL FUNCTION 'REUSE_ALV_VARIANT_F4'

EXPORTING

is_variant = gs_variant

i_save = 'A'

IMPORTING

e_exit = fl_exit

es_variant = *gs_variant

EXCEPTIONS

not_found = 2.

IF sy-subrc = 2.

MESSAGE ID sy-msgid TYPE 'S' NUMBER sy-msgno

WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

ELSE.

IF fl_exit = space.

p_layout = *gs_variant-variant.

ENDIF.

ENDIF.

ENDFORM. " f4_for_variant

Please reward if you find the answer useful.

Thanks,

Kamesh Bathla