[ABAP] Subscreens auf dem Selektionsbild verwenden und per Pushbutton umschalten

SELECTION-SCREEN COMMENT /1(50) comm1.
SELECTION-SCREEN SKIP.

* TabStrip als Containerobjekt, ohne Tabs
SELECTION-SCREEN BEGIN OF TABBED BLOCK sub FOR 3 LINES.
SELECTION-SCREEN END OF BLOCK sub.

* Umschaltbuttons
SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN POSITION 1.
SELECTION-SCREEN PUSHBUTTON (10) btn_1 USER-COMMAND btn_back.
SELECTION-SCREEN PUSHBUTTON (10) btn_2 USER-COMMAND btn_fwd.
SELECTION-SCREEN END OF LINE.

* SUBSCREEN 1
SELECTION-SCREEN BEGIN OF SCREEN 100 AS SUBSCREEN.
SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE title1.
PARAMETERS: p1 TYPE string.
SELECTION-SCREEN END OF BLOCK b1.
SELECTION-SCREEN END OF SCREEN 100.

* SUBSCREEN 2
SELECTION-SCREEN BEGIN OF SCREEN 200 AS SUBSCREEN.
SELECTION-SCREEN BEGIN OF BLOCK b2 WITH FRAME TITLE title2.
PARAMETERS: p2 TYPE string.
SELECTION-SCREEN END OF BLOCK b2.
SELECTION-SCREEN END OF SCREEN 200.

* SUBSCREEN 3
SELECTION-SCREEN BEGIN OF SCREEN 300 AS SUBSCREEN.
SELECTION-SCREEN BEGIN OF BLOCK b3 WITH FRAME TITLE title3.
PARAMETERS: p3 TYPE string.
SELECTION-SCREEN END OF BLOCK b3.
SELECTION-SCREEN END OF SCREEN 300.

INITIALIZATION.
  comm1 = 'Beispiel für die Verwendung von Subscreens'.

  title1 = 'Sub1'.
  title2 = 'Sub2'.
  title3 = 'Sub3'.

  btn_1 = |{ icon_column_left }Zurück|.
  btn_2 = |{ icon_column_right }Vor|.

* Subscreen 100 anzeigen
  sub-prog = sy-repid.
  sub-dynnr = 100.

  p1 = '11'.
  p2 = '22'.
  p3 = '33'.

AT SELECTION-SCREEN.

  CASE sy-dynnr.
    WHEN 100.
      IF sy-ucomm = 'BTN_BACK'.
        sub-dynnr = 300.
      ELSEIF sy-ucomm = 'BTN_FWD'.
        sub-dynnr = 200.
      ENDIF.
    WHEN 200.
      IF sy-ucomm = 'BTN_BACK'.
        sub-dynnr = 100.
      ELSEIF sy-ucomm = 'BTN_FWD'.
        sub-dynnr = 300.
      ENDIF.
    WHEN 300.
      IF sy-ucomm = 'BTN_BACK'.
        sub-dynnr = 200.
      ELSEIF sy-ucomm = 'BTN_FWD'.
        sub-dynnr = 100.
      ENDIF.
  ENDCASE.

START-OF-SELECTION.

  WRITE: / p1, p2, p3.