[ABAP] HTML im Browser-Fenster anzeigen

* Variante 1 (cl_abap_browser)
* Dummy Screen
SELECTION-SCREEN BEGIN OF SCREEN 100.
SELECTION-SCREEN END OF SCREEN 100.

* Daten holen
SELECT * FROM mara INTO TABLE @DATA(it_mara).

* Browserfenster mit HTML-Code im cl_gui_container=>default_screen anzeigen
cl_abap_browser=>show_html( html_string = cl_demo_output=>get( it_mara )
                            container   = cl_gui_container=>default_screen ).

* Toolbar ausblenden
cl_abap_list_layout=>suppress_toolbar( ).

* leeres Dynpro anzeigen und Ausgabe von cl_gui_container=>default_screen erzwingen
CALL SELECTION-SCREEN 100.

[ABAP] Popup-Fenster mit Eingabefeldern anzeigen

Variante 1 (Einfaches Popup-Fenster mit Eingabefeld)

* Button Pos 2 Länge 20, sendet Kommando 'CMD_SHOW'
SELECTION-SCREEN: PUSHBUTTON 2(20) btn1 USER-COMMAND cmd_show.

* Popup-Fenster (Selektionsbild 100) deklarieren
SELECTION-SCREEN BEGIN OF SCREEN 100 TITLE title.
PARAMETERS: p_text TYPE string.
SELECTION-SCREEN END OF SCREEN 100.

INITIALIZATION.
* Fenstertitel
  title = 'Popup'.
* Button-Text setzen
  btn1 = |{ icon_activity }Popup anzeigen|.

AT SELECTION-SCREEN.
* wenn Button-Kommando 'CMD_SHOW'
  IF sy-ucomm = 'CMD_SHOW'.
* Popup-Fenster (Selektionsbild 100) anzeigen
    CALL SELECTION-SCREEN 100 STARTING AT 10 5.
  ENDIF.

START-OF-SELECTION.
* Datenausgabe
  WRITE: / p_text.

Variante 2 (Passwortdialog mit eigenem PF-Status)

* Inspiriert (Quelle) von: http://www.abapgit.org
DATA: gv_user TYPE string.
DATA: gv_pass TYPE string.

**********************************************************************
*
* Dynproelemente für Standard-Selektionbild
*
**********************************************************************
SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN PUSHBUTTON 2(30) b_pop USER-COMMAND pop.
SELECTION-SCREEN END OF LINE.
**********************************************************************
*
* Dynproelemente für Popup
*
**********************************************************************
SELECTION-SCREEN BEGIN OF SCREEN 3000 TITLE s_title.

SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN COMMENT 1(10) s_user FOR FIELD p_user.
PARAMETERS: p_user TYPE string LOWER CASE.
SELECTION-SCREEN END OF LINE.

SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN COMMENT 1(10) s_pass FOR FIELD p_pass.
PARAMETERS: p_pass TYPE string LOWER CASE.
SELECTION-SCREEN END OF LINE.

SELECTION-SCREEN END OF SCREEN 3000.
**********************************************************************
*
* Klasse zur Anzeige des Popup-Fensters
*
**********************************************************************
CLASS lcl_pwdlg DEFINITION FINAL.

  PUBLIC SECTION.
    CONSTANTS: co_dynnr TYPE char4 VALUE '3000'.

    CLASS-METHODS on_initialization.
    CLASS-METHODS on_output.
    CLASS-METHODS on_event
      IMPORTING
        i_ucomm TYPE sy-ucomm.

    CLASS-METHODS show
      IMPORTING
        i_user TYPE string
      EXPORTING
        e_user TYPE string
        e_pass TYPE string.

  PRIVATE SECTION.
    CLASS-DATA: gv_ok TYPE abap_bool.

ENDCLASS.

CLASS lcl_pwdlg IMPLEMENTATION.

  METHOD on_initialization.
    s_title = 'Loginfenster'.
    s_user  = 'Benutzer'.
    s_pass  = 'Passwort'.
  ENDMETHOD.

  METHOD on_output.
    IF sy-dynnr = lcl_pwdlg=>co_dynnr.
* Wenn Popup angezeigt werden soll

* GUI Status aus Program RSDBRUNT setzen (Ausführen- und Schließen-Button)
      PERFORM set_pf_status IN PROGRAM rsdbrunt IF FOUND.

      DATA: it_ucomm TYPE STANDARD TABLE OF sy-ucomm WITH DEFAULT KEY.

* Prüfen-Button entfernen
      APPEND 'NONE' TO it_ucomm.
* Variante-Speichern-Button entfernen
      APPEND 'SPOS' TO it_ucomm.

      CALL FUNCTION 'RS_SET_SELSCREEN_STATUS'
        EXPORTING
          p_status  = sy-pfkey
        TABLES
          p_exclude = it_ucomm.

      IF NOT p_user IS INITIAL.
* Cursor in Passwort-Feld setzen
        SET CURSOR FIELD 'P_PASS'.
      ENDIF.
    ENDIF.
  ENDMETHOD.

  METHOD show.

* User + Passwort setzen
    p_user = i_user.
    CLEAR: p_pass.

    gv_ok = abap_false.

* Selektionsbild CO_DYNNR (das Popup) anzeigen
    CALL SELECTION-SCREEN co_dynnr STARTING AT 15 10 ENDING AT 75 12.

    IF gv_ok = abap_true.
* wenn Popup per Ausführen (F8) oder ENTER geschlossen wird, dann Werte übernehmen
      e_user = p_user.
      e_pass = p_pass.
    ENDIF.

    CLEAR: p_user.
    CLEAR: p_pass.

  ENDMETHOD.

  METHOD on_event.
* Tastendrücke vom Popup abfangen
    IF sy-dynnr = co_dynnr.
      CASE i_ucomm.
        WHEN 'CRET'.
* für Ausführen (F8)
          gv_ok = abap_true.
        WHEN OTHERS.
* für ENTER
          gv_ok = abap_true.
          LEAVE TO SCREEN 0.
      ENDCASE.
    ENDIF.
  ENDMETHOD.

ENDCLASS.

INITIALIZATION.
  b_pop   = 'Popup öffnen'.
* Popup initialisieren
  lcl_pwdlg=>on_initialization( ).

AT SELECTION-SCREEN OUTPUT.
  CASE sy-dynnr.
    WHEN 1000.
* wenn Ereignis aus dem Standart-Selektionsbild (Dynpro 1000) getriggert wird

    WHEN lcl_pwdlg=>co_dynnr.
* wenn Ereignis aus dem Popup (Dynpro CO_DYNNR) getriggert wird
      lcl_pwdlg=>on_output( ).
    WHEN OTHERS.
  ENDCASE.

AT SELECTION-SCREEN.
  CASE sy-dynnr.
    WHEN 1000.
* wenn Ereignis aus dem Standart-Selektionsbild (Dynpro 1000) getriggert wird
      CASE sy-ucomm.
* Button "Popup öffnen" geklickt
        WHEN 'POP'.
* Popup anzeigen
          lcl_pwdlg=>show( EXPORTING i_user = CONV #( sy-uname )
                           IMPORTING e_user = gv_user
                                     e_pass = gv_pass ).
      ENDCASE.
    WHEN lcl_pwdlg=>co_dynnr.
* wenn Ereignis aus dem Popup (Dynpro CO_DYNNR) getriggert wird
      lcl_pwdlg=>on_event( sy-ucomm ).
  ENDCASE.

START-OF-SELECTION.
  WRITE: / gv_user.
  WRITE: / gv_pass.

[ABAP] Einfaches Popupfenster mit Texteditor anzeigen

Variante 1 (cl_gui_dialogbox_container)

DATA: o_cnt TYPE REF TO cl_gui_dialogbox_container.
DATA: o_edit TYPE REF TO cl_gui_textedit.
DATA: it_editor TYPE STANDARD TABLE OF char1024.

CLASS lcl_events DEFINITION.
  PUBLIC SECTION.
    CLASS-METHODS on_close FOR EVENT close OF cl_gui_dialogbox_container
      IMPORTING sender.
ENDCLASS.

CLASS lcl_events IMPLEMENTATION.
* Event, wenn auf das Schließen-Kreuz geklickt wird
  METHOD on_close.
    IF NOT o_edit IS INITIAL.
* vor dem Schließen Text aus dem Editor holen
      o_edit->get_text_as_stream( IMPORTING text = it_editor ).

      sender->free( ).
    ENDIF.
  ENDMETHOD.
ENDCLASS.

* Button Pos 2 Länge 20, sendet Kommando 'CMD_SHOW'
SELECTION-SCREEN: PUSHBUTTON 2(20) btn1 USER-COMMAND cmd_show.

INITIALIZATION.
* Button-Text setzen
  btn1 = |{ icon_activity }Popup anzeigen|.

AT SELECTION-SCREEN.
* wenn Button-Kommando 'CMD_SHOW'
  IF sy-ucomm = 'CMD_SHOW'.

    o_cnt = NEW #( no_autodef_progid_dynnr = abap_true
                   caption = 'Texteditor'
                   top = 100
                   left = 200
                   width = 640
                   height = 240 ).

* on_close Handler setzen
    SET HANDLER lcl_events=>on_close FOR o_cnt.

* neues Editorobjekt erzeugen (überschreibt vorherige Referenz!)
    o_edit = NEW #( wordwrap_mode = cl_gui_textedit=>wordwrap_at_windowborder
                    wordwrap_to_linebreak_mode = cl_gui_textedit=>true
                    parent = o_cnt ).

* feste Zeichenbreite
    o_edit->set_font_fixed( mode = cl_gui_textedit=>true ).
  ENDIF.

START-OF-SELECTION.
  LOOP AT it_editor ASSIGNING FIELD-SYMBOL(<l>).
    WRITE: / <l>.
  ENDLOOP.

Variante 2 (SELECTION-SCREEN)

DATA: it_editor TYPE STANDARD TABLE OF char1024.

* Button Pos 2 Länge 20, sendet Kommando 'CMD_SHOW'
SELECTION-SCREEN: PUSHBUTTON 2(20) btn1 USER-COMMAND cmd_show.

* Popup-Fenster (Selektionsbild 100) deklarieren
SELECTION-SCREEN BEGIN OF SCREEN 100 TITLE title.
SELECTION-SCREEN END OF SCREEN 100.

INITIALIZATION.
* Fenstertitel
  title = 'Texteditor'.
* Button-Text setzen
  btn1 = |{ icon_activity }Popup anzeigen|.

AT SELECTION-SCREEN.
* wenn Button-Kommando 'CMD_SHOW'
  IF sy-ucomm = 'CMD_SHOW'.
* cl_gui_container=>screen1 == SELECTION-SCREEN 100
    DATA(o_edit) = NEW cl_gui_textedit( wordwrap_mode = cl_gui_textedit=>wordwrap_at_windowborder
                                        wordwrap_to_linebreak_mode = cl_gui_textedit=>true
                                        parent = cl_gui_container=>screen1 ).

* feste Zeichenbreite
    o_edit->set_font_fixed( mode = cl_gui_textedit=>true ).

* Popup-Fenster (Selektionsbild 100) anzeigen -> cl_gui_container=>screen1 wird erzeugt
    CALL SELECTION-SCREEN 100 STARTING AT 10 5 ENDING AT 100 20.

* Text aus dem Editor holen
    o_edit->get_text_as_stream( IMPORTING text = it_editor ).

* Editorobjekt freigeben
    FREE: o_edit.
  ENDIF.

START-OF-SELECTION.
  LOOP AT it_editor ASSIGNING FIELD-SYMBOL(<l>).
    WRITE: / <l>.
  ENDLOOP.

[ABAP] Selektionsbild mit HTML-Elementen, Dateneingabe, SALV-Grid, CSS, Eventhandling

**********************************************************************
*
* Datentypen, Variablen, Konstanten
*
**********************************************************************
TYPES: ty_it_events TYPE STANDARD TABLE OF cntl_simple_event WITH DEFAULT KEY.

CONSTANTS: co_carrid TYPE string VALUE 'carrid'.
CONSTANTS: co_airpto TYPE string VALUE 'airpto'.

DATA: o_splitter_main TYPE REF TO cl_gui_splitter_container.
DATA: o_container_l   TYPE REF TO cl_gui_container.
DATA: o_container_r   TYPE REF TO cl_gui_container.
DATA: o_html TYPE REF TO cl_gui_html_viewer.
DATA: o_salv TYPE REF TO cl_salv_table.

DATA: it_spfli TYPE STANDARD TABLE OF spfli WITH DEFAULT KEY.
DATA: it_salv_spfli TYPE STANDARD TABLE OF spfli WITH DEFAULT KEY.
DATA: it_sairport TYPE STANDARD TABLE OF sairport WITH DEFAULT KEY.

DATA: it_html TYPE html_table.
**********************************************************************
*
* Eventhandler
*
**********************************************************************
CLASS lcl_html_events DEFINITION.
  PUBLIC SECTION.
    CLASS-METHODS:
      on_sapevent FOR EVENT sapevent OF cl_gui_html_viewer
        IMPORTING
            action
            frame
            getdata
            postdata
            query_table
            sender.
ENDCLASS.

CLASS lcl_html_events IMPLEMENTATION.
* Link- oder Button-Klick
  METHOD on_sapevent.
    IF o_salv IS BOUND.
      TRY.
* Element in der Nodes-Tabelle lesen
          ASSIGN query_table[ name = co_carrid ] TO FIELD-SYMBOL(<carrid>).
          ASSIGN query_table[ name = co_airpto ] TO FIELD-SYMBOL(<airpto>).

          IF <carrid> IS ASSIGNED AND <airpto> IS ASSIGNED.
* iTab für SALV-Table neu aufbauen, abhängig von der Eingabe in den Formularfeldern
            it_salv_spfli = VALUE #( FOR <f> IN it_spfli WHERE ( ( carrid = <carrid>-value ) AND ( airpto = <airpto>-value ) )
                                     ( <f> )
                                   ).

          ENDIF.

* SALV-Table neu anzeigen
          o_salv->refresh( ).
        CATCH cx_root INTO DATA(e_txt).
          MESSAGE e_txt->get_text( ) TYPE 'S'.
      ENDTRY.
    ENDIF.
  ENDMETHOD.
ENDCLASS.
**********************************************************************
*
* SELECTION-SCREEN
*
**********************************************************************
* leeres Selektionsbild als Dummy für die Container-Objekte (o_splitter_main ...)
SELECTION-SCREEN BEGIN OF SCREEN 2000.
SELECTION-SCREEN END OF SCREEN 2000.
**********************************************************************
*
* INITIALIZATION
*
**********************************************************************
INITIALIZATION.
* Daten holen
  SELECT * INTO TABLE it_spfli FROM spfli.
  SELECT * INTO TABLE it_sairport FROM sairport.

* HTML-Code mit Buttons und Forms
  it_html = VALUE #(
                     ( |<html>| )
                     ( |  <head>| )
                     ( |    <meta http-equiv="content-type" content="text/html; charset=utf-8">| )
                     ( |    <script type="text/javascript">| )
                     ( |      function onKeyDown(f)| )
                     ( |      \{ if(event.keyCode == 13)| )
                     ( |         \{ document[f.name].submit();| )
                     ( |         \}| )
                     ( |      \}| )
                     ( |    </script>| )
                     ( |    <style type="text/css">| )
                     ( |       body \{| )
                     ( |         font-family: Courier New;| )
                     ( |         font-size: 13px;| )
                     ( |         font-style: normal;| )
                     ( |         font-variant: normal;| )
                     ( |         font-weight: 400;| )
                     ( |         line-height: 13px;| )
                     ( |       \}| )
                     ( |       form \{| )
                     ( |         background: lightblue;| )
                     ( |       \}| )
                     ( |       label \{| )
                     ( |         text-align: right;| )
                     ( |         line-height: 1.5;| )
                     ( |         float: left;| )
                     ( |         width: 40%;| )
                     ( |       \}| )
                     ( |       input \{| )
                     ( |         margin: 0 0 1em .2em;| )
                     ( |         padding: .2em .5em;| )
                     ( |         background-color: #fffbf0;| )
                     ( |         border: 1px solid #e7c157;| )
                     ( |         float: left;| )
                     ( |         width: 40%;| )
                     ( |         font-family: Courier New;| )
                     ( |         font-size: 13px;| )
                     ( |         font-style: normal;| )
                     ( |         font-variant: normal;| )
                     ( |         font-weight: 400;| )
                     ( |         line-height: 13px;| )
                     ( |       \}| )
                     ( |       select \{| )
                     ( |         margin: 0 0 1em .2em;| )
                     ( |         padding: .2em .5em;| )
                     ( |         background-color: #fffbf0;| )
                     ( |         border: 1px solid #e7c157;| )
                     ( |         float: left;| )
                     ( |         width: 40%;| )
                     ( |         font-family: Courier New;| )
                     ( |         font-size: 13px;| )
                     ( |         font-style: normal;| )
                     ( |         font-variant: normal;| )
                     ( |         font-weight: 400;| )
                     ( |         line-height: 13px;| )
                     ( |       \}| )
                     ( |       button \{| )
                     ( |         margin-top: 1.5em;| )
                     ( |         float: right;| )
                     ( |       \}| )
                     ( |      </style>| )
                     ( |  </head>| )
                     ( |  <body>| )
                     ( |    <form name="INPUT" accept-charset="utf-8" method="post" action="SAPEVENT:INPUT_FIELDS">| )
                     ( |      <br>| )
                     ( |      <label for="{ co_carrid }">Fluggesellschaft:</label>| )
                     ( |      <input type="text" name="{ co_carrid }" value="LH" onKeyDown="onKeyDown(this.form);">| )
                     ( |      <br>| )
                     ( |      <label for="{ co_airpto }">Zielflughafen:</label>| )
                     ( |      <select name="{ co_airpto }" value="JFK">| )
                   ).

  LOOP AT it_sairport ASSIGNING FIELD-SYMBOL(<a>).
    IF <a>-id = 'JFK'.
      APPEND |        <option selected>{ <a>-id }</option>| TO it_html.
    ELSE.
      APPEND |        <option>{ <a>-id }</option>| TO it_html.
    ENDIF.
  ENDLOOP.

  it_html = VALUE #( BASE it_html
                     ( |      </select>| )
                     ( |      <br>| )
                     ( |      <button type="submit" title="Anzeigen">Anzeigen</button>| )
                     ( |      <br>| )
                     ( |      <br>| )
                     ( |      <br>| )
                     ( |      <br>| )
                     ( |    </form>| )
                     ( |  </body>| )
                     ( |</html>| )
                   ).

**********************************************************************
*
* AT SELECTION-SCREEN OUTPUT
*
**********************************************************************
AT SELECTION-SCREEN OUTPUT.
* Doppelte Objekterzeugung unterbinden
  IF NOT o_splitter_main IS BOUND.
* Splitter auf default_screen (SELECTION-SCREEN 2000) erzeugen
    o_splitter_main = NEW #( parent  = cl_gui_container=>default_screen
                             rows    = 1
                             columns = 2 ).

* Breite in % (linke Spalte für den Tree)
    o_splitter_main->set_column_width( id = 1 width = 20 ).

* linken und rechten Splitcontainer holen
    o_container_l = o_splitter_main->get_container( row = 1 column = 1 ).
    o_container_r = o_splitter_main->get_container( row = 1 column = 2 ).

* HTML-Viewer
    o_html = NEW cl_gui_html_viewer( parent = o_container_l ).

* Eventtypten müssen gesondert registriert werden
    DATA(it_events) = VALUE ty_it_events( ( eventid    = cl_gui_html_viewer=>m_id_sapevent
                                            appl_event = abap_true ) ).

    o_html->set_registered_events( events = it_events ).

* Eventhandler registrieren
    SET HANDLER lcl_html_events=>on_sapevent FOR o_html.

* URL zu HTML holen
    DATA: lv_url TYPE skwf_url.

    o_html->load_data( IMPORTING
                         assigned_url = lv_url
                       CHANGING
                         data_table   = it_html ).

* HTML anzeigen
    o_html->show_url( url = lv_url ).

    it_salv_spfli = it_spfli.

* SALV-Table für Anzeige der Daten
    cl_salv_table=>factory( EXPORTING
                              r_container    = o_container_r
                            IMPORTING
                              r_salv_table   = o_salv
                            CHANGING
                              t_table        = it_salv_spfli ).

    o_salv->get_display_settings( )->set_striped_pattern( abap_true ).
    o_salv->get_columns( )->set_optimize( abap_true ).
    o_salv->get_functions( )->set_all( ).
    o_salv->get_selections( )->set_selection_mode( if_salv_c_selection_mode=>row_column ).
    o_salv->display( ).
  ENDIF.
**********************************************************************
*
* AT SELECTION-SCREEN
*
**********************************************************************
AT SELECTION-SCREEN.
* wenn "Ausführen" (F8) geklickt wurde
  IF sy-ucomm = 'CRET'.
* Selektionbild 2000 wieder anzeigen
    CALL SELECTION-SCREEN 2000.
  ENDIF.
**********************************************************************
*
* START-OF-SELECTION
*
**********************************************************************
START-OF-SELECTION.
* leeres Selektionbild 2000 anzeigen
  CALL SELECTION-SCREEN 2000.

[ABAP] Tree und SALV-Grid auf dem Selektionsbild ohne zus. Dynpro anzeigen, Eventhandling

**********************************************************************
*
* Datentypen, Variablen, Konstanten
*
**********************************************************************
TYPES: ty_it_events TYPE STANDARD TABLE OF cntl_simple_event WITH DEFAULT KEY.
TYPES: ty_it_nodes TYPE STANDARD TABLE OF mtreesnode WITH DEFAULT KEY.

DATA: o_splitter_main TYPE REF TO cl_gui_splitter_container.
DATA: o_container_l   TYPE REF TO cl_gui_container.
DATA: o_container_r   TYPE REF TO cl_gui_container.
DATA: o_tree TYPE REF TO cl_gui_simple_tree.
DATA: o_salv TYPE REF TO cl_salv_table.

DATA: it_tree_spfli TYPE STANDARD TABLE OF spfli.
DATA: it_salv_spfli TYPE STANDARD TABLE OF spfli.
DATA: it_nodes TYPE ty_it_nodes.
**********************************************************************
*
* Eventhandler
*
**********************************************************************
CLASS lcl_events DEFINITION.
  PUBLIC SECTION.
    CLASS-METHODS: on_selection_changed FOR EVENT selection_changed OF cl_gui_simple_tree
      IMPORTING
          node_key
          sender.
ENDCLASS.

CLASS lcl_events IMPLEMENTATION.
* Klick auf ein aktives Baumelement
  METHOD on_selection_changed.
    IF o_salv IS BOUND.
* Element in der Nodes-Tabelle lesen
      ASSIGN it_nodes[ node_key = node_key ] TO FIELD-SYMBOL(<fs_node>).

* iTab für SALV-Table neu aufbauen, abhängig vom gewählten Baumelement
      it_salv_spfli = VALUE #( FOR l IN it_tree_spfli WHERE ( carrid = <fs_node>-text )
                               ( mandt = l-mandt
                                 carrid = l-carrid
                                 connid = l-connid
                                 countryfr = l-countryfr
                                 cityfrom = l-cityfrom
                                 airpfrom = l-airpfrom
                                 countryto = l-countryto
                                 cityto = l-cityto
                                 airpto = l-airpto
                                 fltime = l-fltime
                                 deptime = l-deptime
                                 arrtime = l-arrtime
                                 distance = l-distance
                                 distid = l-distid
                                 fltype = l-fltype
                                 period = l-period ) ).

* SALV-Table neu anzeigen
      o_salv->refresh( ).
    ENDIF.
  ENDMETHOD.
ENDCLASS.
**********************************************************************
*
* SELECTION-SCREEN
*
**********************************************************************
* leeres Selektionsbild als Dummy für die Container-Objekte (o_splitter_main ...)
SELECTION-SCREEN BEGIN OF SCREEN 2000.
SELECTION-SCREEN END OF SCREEN 2000.
**********************************************************************
*
* INITIALIZATION
*
**********************************************************************
INITIALIZATION.
  SELECT * INTO TABLE it_tree_spfli FROM spfli.
**********************************************************************
*
* START-OF-SELECTION
*
**********************************************************************
START-OF-SELECTION.
* leeres Selektionbild 2000 anzeigen
  CALL SELECTION-SCREEN 2000.
**********************************************************************
*
* AT SELECTION-SCREEN OUTPUT
*
**********************************************************************
AT SELECTION-SCREEN OUTPUT.
* Doppelte Objekterzeugung unterbinden
  IF NOT o_splitter_main IS BOUND.
* Splitter auf default_screen (SELECTION-SCREEN 2000) erzeugen
    o_splitter_main = NEW #( parent  = cl_gui_container=>default_screen
                             rows    = 1
                             columns = 2 ).

* Breite in % (linke Spalte für den Tree)
    o_splitter_main->set_column_width( id = 1 width = 15 ).

* linken und rechten Splitcontainer holen
    o_container_l = o_splitter_main->get_container( row = 1 column = 1 ).
    o_container_r = o_splitter_main->get_container( row = 1 column = 2 ).

* Tree-Objekt erzeugen
    o_tree = NEW #( parent = o_container_l
                    node_selection_mode = cl_gui_simple_tree=>node_sel_mode_single ).

* Eventtypten müssen gesondert registriert werden
    DATA(it_events) = VALUE ty_it_events( ( eventid = cl_gui_simple_tree=>eventid_selection_changed
                                            appl_event = abap_true ) ).

    o_tree->set_registered_events( events = it_events ).

    SET HANDLER lcl_events=>on_selection_changed FOR o_tree.

* Root-Node einfügen
    it_nodes = VALUE #( ( node_key  = 'ROOT'           " Node-Bezeichner
                          relatship = cl_gui_simple_tree=>relat_last_child
                          disabled  = abap_true
                          isfolder  = abap_true        " Typ Ordner für Root-Element
                          n_image   = icon_folder      " Icon Ordner
                          exp_image = icon_open_folder " Icon geöffneter Ordner
                          style     = cl_gui_simple_tree=>style_default
                          text      = 'Airlines' ) ).

* Childs an Root-Node anhängen
    LOOP AT it_tree_spfli ASSIGNING FIELD-SYMBOL(<fs_line>).
* bei Änderung der carrid neue carrid als Child anhängen
      AT NEW carrid.
        APPEND VALUE #( node_key  = |NODE{ sy-tabix }| " Node-Bezeichner
                        relatship = cl_gui_simple_tree=>relat_last_child
                        relatkey  = 'ROOT'             " an ROOT-Element anhängen
                        style     = cl_gui_simple_tree=>style_intensified
                        text      = |{ <fs_line>-carrid }| ) TO it_nodes.
      ENDAT.
    ENDLOOP.

* Nodes im Baum einfügen
    o_tree->add_nodes( table_structure_name = 'MTREESNODE' " Typ muss gleich mit Zeilentyp von ty_it_nodes sein
                       node_table           = it_nodes ).

* Root-Nodes des Trees expandieren
    o_tree->expand_root_nodes( ).

* leeres SALV-Grid erzeugen
    cl_salv_table=>factory( EXPORTING
                              r_container    = o_container_r
                            IMPORTING
                              r_salv_table   = o_salv
                            CHANGING
                              t_table        = it_salv_spfli ).

    o_salv->get_display_settings( )->set_striped_pattern( abap_true ).
    o_salv->get_columns( )->set_optimize( abap_true ).
    o_salv->get_functions( )->set_all( ).
    o_salv->get_selections( )->set_selection_mode( if_salv_c_selection_mode=>row_column ).
    o_salv->display( ).
  ENDIF.
**********************************************************************
*
* AT SELECTION-SCREEN
*
**********************************************************************
AT SELECTION-SCREEN.
* wenn "Ausführen" (F8) geklickt wurde
  IF sy-ucomm = 'CRET'.
* Selektionbild 2000 wieder anzeigen
    CALL SELECTION-SCREEN 2000.
  ENDIF.

[ABAP] Folge von Selektionsbildschirmen durchschalten

SELECTION-SCREEN BEGIN OF SCREEN 100.
SELECTION-SCREEN BEGIN OF BLOCK sel1 WITH FRAME TITLE title1.
PARAMETERS: p_s_v TYPE spfli-cityfrom.
PARAMETERS: p_s_n TYPE spfli-cityto.
SELECTION-SCREEN END OF BLOCK sel1.
SELECTION-SCREEN END OF SCREEN 100.

SELECTION-SCREEN BEGIN OF SCREEN 200.
SELECTION-SCREEN BEGIN OF BLOCK sel2 WITH FRAME TITLE title2.
PARAMETERS: p_fh_v TYPE spfli-airpfrom.
PARAMETERS: p_fh_n TYPE spfli-airpto.
SELECTION-SCREEN END OF BLOCK sel2.
SELECTION-SCREEN END OF SCREEN 200.

INITIALIZATION.
  title1 = 'Städte'.
  title2 = 'Flughäfen'.

START-OF-SELECTION.
  CALL SELECTION-SCREEN 100 STARTING AT 10 10.
  CALL SELECTION-SCREEN 200 STARTING AT 10 10.