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: 

apply different layout

former_member533538
Participant
0 Kudos

hello all,i am facing a problem now:i develop an ABAP report program,with 3 radio buttons on selection screen,output 3 lists correspondingly,they get different fields,now if i config a userlayout for one output list,and set it as default layout for all users,this layout will apply to another two lists,how can i make it as list -specific for all users?i tried to create 3 GUIs,but it failed,any suggestion will be appreciate.

1 ACCEPTED SOLUTION

raymond_giuseppi
Active Contributor
0 Kudos

Add a "handle" in your variant (structure DISVARIANT, field handle) use a different handle value for each list, so you can have 3 different default layouts, and layouts are related to one list.

ls_variant-report = sy-repid.
IF radio1 EQ c_x.
  ls_variant-handle = '0001'.
ELSEIF radio2 EQ c_x.
  ls_variant-handle = '0002'.
ELSEIF radio3 EQ c_x.
  ls_variant-handle = '0003'.
ENDIF.

Regards,

Raymond

3 REPLIES 3

raymond_giuseppi
Active Contributor
0 Kudos

Add a "handle" in your variant (structure DISVARIANT, field handle) use a different handle value for each list, so you can have 3 different default layouts, and layouts are related to one list.

ls_variant-report = sy-repid.
IF radio1 EQ c_x.
  ls_variant-handle = '0001'.
ELSEIF radio2 EQ c_x.
  ls_variant-handle = '0002'.
ELSEIF radio3 EQ c_x.
  ls_variant-handle = '0003'.
ENDIF.

Regards,

Raymond

0 Kudos

Raymond ,thank you very much.I am new about SAP,can you explain more detail ?i am confused that how can i use handle to connect to specific layout?

0 Kudos

I supposed you use ALV (OO, LVC or REUSE FM) all those objects have parameters to manage display variants : look for IS_VARIANT and I_SAVE, the code above was intended to be used to fill IS_VARIANT parameter :

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
     EXPORTING
(...)
          i_save     = lv_save
          is_variant = ls_variant
(...)

or

CALL METHOD alv->set_table_for_first_display
  EXPORTING
(...)
    is_variant                    = ls_variant
    i_save                        = lv_save
(...)

The use of handle allow management of many different ALV layouts in a single program.

Regards,

Raymond