Code: Alles auswählen.
PARAMETERS: p_layout TYPE disvariant-variant.
INITIALIZATION.
PERFORM get_default_layout CHANGING p_layout.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_layout.
PERFORM f4_layouts CHANGING p_layout.
START-OF-SELECTION.
TRY.
CALL METHOD cl_salv_table=>factory
EXPORTING
r_container = cl_gui_custom_container=>default_screen
IMPORTING
r_salv_table = DATA(r_alv)
CHANGING
t_table = gt_data
CATCH cx_salv_msg.
ENDTRY.
ls_layout-report = sy-repid.
data(r_layout)= _r_alv->get_layout( ).
if r_layout is bound.
r_layout->set_key( ls_layout ).
r_layout->set_save_restriction( if_salv_c_layout=>restrict_none ).
endif.
" 2 includes für Unterprogramme
FORM get_default_layout CHANGING p_p_layout.
DATA:
ls_layout TYPE salv_s_layout_info,
ls_key TYPE salv_s_layout_key.
ls_key-report = sy-repid.
ls_layout = cl_salv_layout_service=>get_default_layout(
s_key = ls_key
).
p_layout = ls_layout-layout.
ENDFORM.
FORM f4_layout CHANGING p_p_layout.
DATA: ls_layout TYPE SALV_S_LAYOUT_INFO,
ls_key TYPE salv_s_layout_key.
ls_key-report = sy-repid.
ls_layout = cl_salv_layout_service=>GET_DEFAULT_LAYOUT( s_key = ls_key ).
* p_layout = ls_layout-layout.
ENDFORM.
Stark! Hätte ich niemals gedacht!!!