* Quelle: https://www.tricktresor.de/blog/controls-stapeln/
DATA: it_mara TYPE STANDARD TABLE OF mara WITH DEFAULT KEY.
DATA: o_dock TYPE REF TO cl_gui_docking_container.
DATA: o_txt TYPE REF TO cl_gui_textedit.
DATA: o_alv TYPE REF TO cl_gui_alv_grid.
PARAMETERS: rb_txt RADIOBUTTON GROUP rbg DEFAULT 'X' USER-COMMAND rbc.
PARAMETERS: rb_alv RADIOBUTTON GROUP rbg.
INITIALIZATION.
IF NOT o_dock IS BOUND.
* Containerobjekt erzeugen
o_dock = NEW #( side = cl_gui_docking_container=>dock_at_bottom
ratio = 90 ).
* Texteditor erzeugen
o_txt = NEW #( parent = o_dock ).
* Daten für ALV holen
SELECT *
INTO TABLE @it_mara
FROM mara
UP TO 100 ROWS.
* ALV-Gitter erzeugen
o_alv = NEW #( i_parent = o_dock ).
o_alv->set_table_for_first_display( EXPORTING
i_structure_name = 'MARA'
CHANGING
it_outtab = it_mara ).
ENDIF.
AT SELECTION-SCREEN.
* wenn Radiobuttons geklickt
IF sy-ucomm = 'RBC'.
* je nach Radiobutton die GUI-Controls ein-/ausblenden
CASE abap_true.
WHEN rb_txt.
o_txt->set_visible( abap_true ).
o_alv->set_visible( abap_false ).
WHEN rb_alv.
o_txt->set_visible( abap_false ).
o_alv->set_visible( abap_true ).
ENDCASE.
ENDIF.