[ABAP] Vertikaler Tabstrip-Container für Controls (CL_GUI_CONTAINER_BAR_XT, CL_GUI_CONTAINER_BAR_2, CL_GUI_CONTAINER_BAR)

Variante 1 (CL_GUI_CONTAINER_BAR_XT)

CLASS lcl_events DEFINITION.
  PUBLIC SECTION.
    CLASS-METHODS:
      on_clicked FOR EVENT clicked OF cl_gui_container_bar_xt
        IMPORTING
            id
            container
            sender.
    CLASS-METHODS:
      on_empty FOR EVENT empty OF cl_gui_container_bar_xt
        IMPORTING
            sender.
    CLASS-METHODS:
      on_closed FOR EVENT closed OF cl_gui_container_bar_xt
        IMPORTING
            id
            sender.
ENDCLASS.

CLASS lcl_events IMPLEMENTATION.
* Eintrag angeklickt
  METHOD on_clicked.
    MESSAGE |Property: { id } { container->get_container_type( ) }| TYPE 'S'.
  ENDMETHOD.
* wenn keine Einträge mehr vorhanden (z.B. alle durch Klick auf die Schließen-Kreuze geschlossen)
  METHOD on_empty.
    BREAK-POINT.
  ENDMETHOD.
* wenn Schließen-Kreuz eines Eintrages geklickt
  METHOD on_closed.
    BREAK-POINT.
  ENDMETHOD.
ENDCLASS.

INITIALIZATION.
  TRY.
* Vertikalen Splitter erzeugen
      DATA(o_splitter) = NEW cl_gui_splitter_container( parent                  = cl_gui_container=>default_screen
                                                        no_autodef_progid_dynnr = abap_true
                                                        rows                    = 1
                                                        columns                 = 2 ).

* 10% / 90% Teilung
      o_splitter->set_column_width( id = 1 width = 10 ).

      DATA(o_container_left) = o_splitter->get_container( row = 1 column = 1 ).
      DATA(o_container_right) = o_splitter->get_container( row = 1 column = 2 ).

* Zwei Einträge im cl_gui_container_bar_xt
      DATA(it_captions) = VALUE sbptcaptns( ( caption      = 'ABAP'
                                              icon         = icon_abap
                                              no_close     = abap_false
                                              name         = 'CAP1'
                                              invisible    = abap_false
                                              pre_inst     = abap_false
                                              reuse_cnt_of = '' )
                                            ( caption      = 'ABC'
                                              icon         = icon_abc
                                              no_close     = abap_false
                                              name         = 'CAP2'
                                              invisible    = abap_false
                                              pre_inst     = abap_false
                                              reuse_cnt_of = '' ) ).

* cl_gui_container_bar_xt im linken Splitter erzeugen
      DATA(o_toolbar_xt) = NEW cl_gui_container_bar_xt( active_id     = 1                                    " Nr. des aktiven Eintrages
                                                        parent        = o_container_left                     " Einbettung in linken Container
                                                        captions      = it_captions                          " Einträge
                                                        style         = cl_gui_container_bar_xt=>c_style_fix " Style: Fix = Feste Anordnung, Outlook = Anordnung klappt
                                                        close_buttons = abap_true ).                         " Schließen Kreuze anzeigen

* einen weiterer Eintrag im cl_gui_container_bar_xt hinzufügen
      DATA(lv_caption) = VALUE sbptcaptn( caption      = 'Activate'
                                          icon         = icon_activate
                                          no_close     = abap_false
                                          name         = 'CAP3'
                                          invisible    = abap_false
                                          pre_inst     = abap_false
                                          reuse_cnt_of = '' ).

* Eintrag einfügen und Id holen
      DATA(lv_id) = 0.
      o_toolbar_xt->add_cell( EXPORTING caption = lv_caption
                              CHANGING  id      = lv_id ).

* Testweise Container zum Eintrag ermitteln
      DATA(o_cont) = o_toolbar_xt->get_container( id = lv_id ).

* letzen Eintrag im cl_gui_container_bar_xt aktiv (ausgewählt) setzen
      o_toolbar_xt->set_active( id = lv_id ).

* Eventhandler registrieren
      SET HANDLER lcl_events=>on_clicked FOR o_toolbar_xt.
      SET HANDLER lcl_events=>on_empty FOR o_toolbar_xt.
      SET HANDLER lcl_events=>on_closed FOR o_toolbar_xt.

* im rechten Splitter Beispieldaten anzeigen
      DATA: it_sflight TYPE STANDARD TABLE OF sflight.

      SELECT * FROM sflight INTO TABLE @it_sflight.

      DATA: o_salv TYPE REF TO cl_salv_table.

      cl_salv_table=>factory( EXPORTING
                                r_container    = o_container_right
                              IMPORTING
                                r_salv_table   = o_salv
                              CHANGING
                                t_table        = it_sflight ).

      o_salv->get_functions( )->set_all( ).
      o_salv->display( ).

* leere Standard-Toolbar ausblenden
      cl_abap_list_layout=>suppress_toolbar( ).

* Ausgabe von cl_gui_container=>default_screen erzwingen
      WRITE: space.
    CATCH cx_root INTO DATA(e_txt).
  ENDTRY.

Variante 2 (CL_GUI_CONTAINER_BAR_2)

CLASS lcl_events DEFINITION.
  PUBLIC SECTION.
    CLASS-METHODS:
      on_clicked FOR EVENT clicked OF cl_gui_container_bar_2
        IMPORTING
            id
            container
            sender.
    CLASS-METHODS:
      on_empty FOR EVENT empty OF cl_gui_container_bar_2
        IMPORTING
            sender.
    CLASS-METHODS:
      on_closed FOR EVENT closed OF cl_gui_container_bar_2
        IMPORTING
            id
            sender.
ENDCLASS.

CLASS lcl_events IMPLEMENTATION.
* Eintrag angeklickt
  METHOD on_clicked.
    MESSAGE |Property: { id } { container->get_container_type( ) }| TYPE 'S'.
  ENDMETHOD.
* wenn keine Einträge mehr vorhanden (z.B. alle durch Klick auf die Schließen-Kreuze geschlossen)
  METHOD on_empty.
    BREAK-POINT.
  ENDMETHOD.
* wenn Schließen-Kreuz eines Eintrages geklickt
  METHOD on_closed.
    BREAK-POINT.
  ENDMETHOD.
ENDCLASS.

INITIALIZATION.
  TRY.
* Vertikalen Splitter erzeugen
      DATA(o_splitter) = NEW cl_gui_splitter_container( parent                  = cl_gui_container=>default_screen
                                                        no_autodef_progid_dynnr = abap_true
                                                        rows                    = 1
                                                        columns                 = 2 ).

* 10% / 90% Teilung
      o_splitter->set_column_width( id = 1 width = 10 ).

      DATA(o_container_left) = o_splitter->get_container( row = 1 column = 1 ).
      DATA(o_container_right) = o_splitter->get_container( row = 1 column = 2 ).

* Zwei Einträge im cl_gui_container_bar_2
      DATA(it_captions) = VALUE sbptcaptns( ( caption      = 'ABAP'
                                              icon         = icon_abap
                                              no_close     = abap_false
                                              name         = 'CAP1'
                                              invisible    = abap_false
                                              pre_inst     = abap_false
                                              reuse_cnt_of = '' )
                                            ( caption      = 'ABC'
                                              icon         = icon_abc
                                              no_close     = abap_false
                                              name         = 'CAP2'
                                              invisible    = abap_false
                                              pre_inst     = abap_false
                                              reuse_cnt_of = '' ) ).

* cl_gui_container_bar_2 im linken Splitter erzeugen
      DATA(o_toolbar) = NEW cl_gui_container_bar_2( active_id     = 1                                    " Nr. des aktiven Eintrages
                                                    parent        = o_container_left                     " Einbettung in linken Container
                                                    captions      = it_captions                          " Einträge
                                                    style         = cl_gui_container_bar_2=>c_style_tile " Style: Fix = Feste Anordnung, tile = Menü, Outlook = Anordnung klappt
                                                    close_buttons = abap_false ).                        " Schließen Kreuze anzeigen

* einen weiterer Eintrag im cl_gui_container_bar_2 hinzufügen
      DATA(lv_caption) = VALUE sbptcaptn( caption      = 'Activate'
                                          icon         = icon_activate
                                          no_close     = abap_false
                                          name         = 'CAP3'
                                          invisible    = abap_false
                                          pre_inst     = abap_false
                                          reuse_cnt_of = '' ).

* Eintrag einfügen und Id holen
      DATA(lv_id) = 0.
      o_toolbar->add_cell( EXPORTING caption = lv_caption
                           CHANGING  id      = lv_id ).

* Testweise Container zum Eintrag ermitteln
      DATA(o_cont) = o_toolbar->get_container( id = lv_id ).

* letzen Eintrag im cl_gui_container_bar_2 aktiv (ausgewählt) setzen
      o_toolbar->set_active( id = lv_id ).

* Eventhandler registrieren
      SET HANDLER lcl_events=>on_clicked FOR o_toolbar.
      SET HANDLER lcl_events=>on_empty FOR o_toolbar.
      SET HANDLER lcl_events=>on_closed FOR o_toolbar.

* im rechten Splitter Beispieldaten anzeigen
      DATA: it_sflight TYPE STANDARD TABLE OF sflight.

      SELECT * FROM sflight INTO TABLE @it_sflight.

      DATA: o_salv TYPE REF TO cl_salv_table.

      cl_salv_table=>factory( EXPORTING
                                r_container    = o_container_right
                              IMPORTING
                                r_salv_table   = o_salv
                              CHANGING
                                t_table        = it_sflight ).

      o_salv->get_functions( )->set_all( ).
      o_salv->display( ).

* leere Standard-Toolbar ausblenden
      cl_abap_list_layout=>suppress_toolbar( ).

* Ausgabe von cl_gui_container=>default_screen erzwingen
      WRITE: space.
    CATCH cx_root INTO DATA(e_txt).
  ENDTRY.

Variante 3 (CL_GUI_CONTAINER_BAR)

CLASS lcl_events DEFINITION.
  PUBLIC SECTION.
    CLASS-METHODS:
      on_clicked FOR EVENT clicked OF cl_gui_container_bar
        IMPORTING
            id
            container
            sender.
ENDCLASS.

CLASS lcl_events IMPLEMENTATION.
* Eintrag angeklickt
  METHOD on_clicked.
    MESSAGE |Property: { id } { container->get_container_type( ) }| TYPE 'S'.
  ENDMETHOD.
ENDCLASS.

INITIALIZATION.
  TRY.
* Vertikalen Splitter erzeugen
      DATA(o_splitter) = NEW cl_gui_splitter_container( parent                  = cl_gui_container=>default_screen
                                                        no_autodef_progid_dynnr = abap_true
                                                        rows                    = 1
                                                        columns                 = 2 ).

* 10% / 90% Teilung
      o_splitter->set_column_width( id = 1 width = 10 ).

      DATA(o_container_left) = o_splitter->get_container( row = 1 column = 1 ).
      DATA(o_container_right) = o_splitter->get_container( row = 1 column = 2 ).

* Drei Einträge im cl_gui_container_bar
      DATA(it_captions) = VALUE sbptcaptns( ( caption      = 'ABAP'
                                              icon         = icon_abap
                                              no_close     = abap_false
                                              name         = 'CAP1'
                                              invisible    = abap_false
                                              pre_inst     = abap_false
                                              reuse_cnt_of = '' )
                                            ( caption      = 'ABC'
                                              icon         = icon_abc
                                              no_close     = abap_false
                                              name         = 'CAP2'
                                              invisible    = abap_false
                                              pre_inst     = abap_false
                                              reuse_cnt_of = '' )
                                            ( caption      = 'Activate'
                                              icon         = icon_activate
                                              no_close     = abap_false
                                              name         = 'CAP3'
                                              invisible    = abap_false
                                              pre_inst     = abap_false
                                              reuse_cnt_of = '' ) ).

* cl_gui_container_bar im linken Splitter erzeugen
      DATA(o_toolbar) = NEW cl_gui_container_bar( active_id     = 1                " Nr. des aktiven Eintrages
                                                  parent        = o_container_left " Einbettung in linken Container
                                                  captions      = it_captions ).   " Einträge

* Eventhandler registrieren
      SET HANDLER lcl_events=>on_clicked FOR o_toolbar.

* im rechten Splitter Beispieldaten anzeigen
      DATA: it_sflight TYPE STANDARD TABLE OF sflight.

      SELECT * FROM sflight INTO TABLE @it_sflight.

      DATA: o_salv TYPE REF TO cl_salv_table.

      cl_salv_table=>factory( EXPORTING
                                r_container    = o_container_right
                              IMPORTING
                                r_salv_table   = o_salv
                              CHANGING
                                t_table        = it_sflight ).

      o_salv->get_functions( )->set_all( ).
      o_salv->display( ).

* leere Standard-Toolbar ausblenden
      cl_abap_list_layout=>suppress_toolbar( ).

* Ausgabe von cl_gui_container=>default_screen erzwingen
      WRITE: space.
    CATCH cx_root INTO DATA(e_txt).
  ENDTRY.

[ABAP] Verwendung des GUI-Controls cl_gui_calendar

* SAPCALENDAR_DEMO1
* SAPCALENDAR_DRAG_DROP
* RSDEMO_CALENDAR_CONTROL
DATA: o_cnt TYPE REF TO cl_gui_dialogbox_container.
DATA: o_cal TYPE REF TO cl_gui_calendar.

* Dummyparameter für Selektion im Kalender
PARAMETERS: p_week TYPE string.
PARAMETERS: p_date TYPE string.

CLASS lcl_events DEFINITION.
  PUBLIC SECTION.
    CLASS-METHODS on_close FOR EVENT close OF cl_gui_dialogbox_container
      IMPORTING
          sender.
    CLASS-METHODS on_date_selected FOR EVENT date_selected OF cl_gui_calendar
      IMPORTING
          date_begin
          date_end
          sender.
ENDCLASS.

CLASS lcl_events IMPLEMENTATION.
* Event, wenn auf das Schließen-Kreuz geklickt wird
  METHOD on_close.
    sender->free( ).
  ENDMETHOD.

* Event für Datumsselektion im Kalender
  METHOD on_date_selected.
    DATA: lv_date_begin TYPE cnca_utc_date.

    TRY.
        sender->get_selection( IMPORTING date_begin = lv_date_begin ).

        p_week = cl_bs_period_toolset_basics=>get_calendar_week( CONV #( lv_date_begin ) ).
        p_date = lv_date_begin.
      CATCH cx_root INTO DATA(e_txt).
    ENDTRY.

  ENDMETHOD.

ENDCLASS.

AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_week.
* Popupfenster
  o_cnt = NEW #( no_autodef_progid_dynnr = abap_true
                 caption = 'Kalender'
                 top = 100
                 left = 200
                 width = 640
                 height = 120 ).

* on_close Handler für Popup setzen
  SET HANDLER lcl_events=>on_close FOR o_cnt.

* neues Kalenderobjekt erzeugen (überschreibt vorherige Referenz!)
  o_cal = NEW #( parent          = o_cnt
                 selection_style = cnca_sel_week
                 view_style      = cnca_style_h_navigator ).

  DATA: it_events TYPE cntl_simple_events.

  it_events = VALUE #( ( eventid = cl_gui_calendar=>m_id_date_selected
                         appl_event = abap_true ) ).

  o_cal->set_registered_events( events = it_events ).

  SET HANDLER lcl_events=>on_date_selected FOR o_cal.

START-OF-SELECTION.
  WRITE / p_week.
  WRITE / p_date.

[ABAP] Daten in einem Baum/Tree in der Listanzeige darstellen und Button- und Maus-Events abfangen

* obsolete Darstellung über die FuBas RS_TREE_CONSTRUCT und RS_TREE_LIST_DISPLAY
* besser ist die Nutzung der Klassen cl_salv_tree, cl_gui_simple_tree, cl_gui_column_tree, cl_gui_list_tree
SELECT kunnr,
       land1,
       name1,
       ort01
  INTO TABLE @DATA(it_kna1)
  FROM kna1
  UP TO 25 ROWS.

SELECT vbeln,
       erdat,
       erzet,
       netwr,
       waerk,
       kunnr
  INTO TABLE @DATA(it_vbak)
  FROM vbak
  FOR ALL ENTRIES IN @it_kna1
  WHERE kunnr = @it_kna1-kunnr.

SELECT vbeln,
       posnr,
       matnr,
       netwr,
       waerk
  INTO TABLE @DATA(it_vbap)
  FROM vbap
  FOR ALL ENTRIES IN @it_vbak
  WHERE vbeln = @it_vbak-vbeln.

* Rootnode (Node-Level 1)
DATA(it_nodes) = VALUE snodetab( ( tlevel  = 1
                                   name    = 'Kundenstamm'
                                   nlength = 27
                                   color   = col_key
                                   text    = 'Verkaufs-Report'
                                   tlength = 50
                                 )
                               ).

LOOP AT it_kna1 ASSIGNING FIELD-SYMBOL(<k>).
* Node-Level 2
  DATA(lv_node_2) = VALUE snodetext( tlevel   = 2
                                     name     = <k>-kunnr
                                     nlength  = 19
                                     color    = col_key
                                     text     = <k>-land1
                                     tlength  = 5
                                     tcolor   = col_normal
                                     text1    = <k>-name1
                                     tlength1 = 40
                                     tcolor1  = col_normal
                                     text2    = <k>-ort01
                                     tlength2 = 25
                                     tcolor2  = col_normal
                                   ).

  APPEND lv_node_2 TO it_nodes.

  LOOP AT it_vbak ASSIGNING FIELD-SYMBOL(<v>) WHERE kunnr = <k>-kunnr.
* Node-Level 3
    DATA(lv_node_3) = VALUE snodetext( tlevel   = 3
                                       name     = <v>-vbeln
                                       nlength  = 15
                                       color    = col_positive
                                       text     = <v>-erdat
                                       tlength  = 12
                                       tcolor   = col_normal
                                       text1    = <v>-erzet
                                       tlength1 = 10
                                       tcolor1  = col_normal
                                       text2    = <v>-netwr
                                       tlength2 = 15
                                       tcolor2  = col_total
                                       text3    = <v>-waerk
                                       tlength3 = 5
                                       tcolor3  = col_total
                                     ).

    APPEND lv_node_3 TO it_nodes.

    LOOP AT it_vbap ASSIGNING FIELD-SYMBOL(<p>) WHERE vbeln = <v>-vbeln.
* Node-Level 4
      DATA(lv_node_4) = VALUE snodetext( tlevel   = 4
                                         name     = <p>-posnr
                                         nlength  = 11
                                         color    = col_group
                                         text     = <p>-matnr
                                         tlength  = 23
                                         tcolor   = col_normal
                                         text1    = <p>-netwr
                                         tlength1 = 15
                                         tcolor1  = col_total
                                         text2    = <p>-waerk
                                         tlength2 = 5
                                         tcolor2  = col_total
                                       ).

      APPEND lv_node_4 TO it_nodes.

    ENDLOOP.

  ENDLOOP.

ENDLOOP.

* Tree-Objekte in Funktionsgruppe SEUT
* Neue Hierarchie aufbauen bzw. Teilbaum einfügen
CALL FUNCTION 'RS_TREE_CONSTRUCT'
  TABLES
    nodetab            = it_nodes
  EXCEPTIONS
    tree_failure       = 1
    id_not_found       = 2
    wrong_relationship = 3
    OTHERS             = 4.

IF sy-subrc = 0.
* Konstanten sind in Typgruppe STREE definiert
* Hierarchie anzeigen
  CALL FUNCTION 'RS_TREE_LIST_DISPLAY'
    EXPORTING
      callback_program      = sy-repid
      callback_user_command = 'ON_USER_COMMAND' " Formroutine für Callback-Funktion für Buttons und Mausklicks
      status                = 'STANDARD'        " GUI-Status des Trees (wird für Callback benötigt, kann sonst weggelassen werden
      use_control           = stree_use_list.   " stree_use_list (Liste), stree_use_list_print (Druckausgabe), stree_use_control (Fullscreen-Control), stree_use_in_dynpro (Dynpro)
ELSE.
  WRITE: / 'Fehler:', sy-subrc.
ENDIF.

* Form ON_USER_COMMAND
* Callback-Funktion für Buttons und Mausklicks
FORM on_user_command TABLES   node STRUCTURE seucomm
                     USING    command
                     CHANGING exit
                              list_refresh.

* Messagetext ausgeben, um geklicktes Element zu identifizieren
  MESSAGE |{ node-name }, { command }| TYPE 'S'.
ENDFORM.

[ABAP] Popup-Dialog zur Anzeige von BAPI-Meldungen

DATA(it_bapi_ret) = VALUE bapiret2_t( ).

* hier BAPI-Aufruf, welcher it_bapi_ret füllt
...

Variante 1 (CBIH_IAALD_BAPIRET2_SHOW)

* EHS: Anzeige einer BAPI-Fehlermeldungstabelle (BAPIRET2)
CALL FUNCTION 'CBIH_IAALD_BAPIRET2_SHOW'
  TABLES
    i_bapiret2_tab = it_bapi_ret.

Variante 2 (ISH_BAPIRET2_DISPLAY)

* IS-H: Nachrichten aus BAPIRET2-Tabelle anzeigen
CALL FUNCTION 'ISH_BAPIRET2_DISPLAY'
  EXPORTING
    amodal_window = abap_false " Fenster modal / amodal anzeigen
  TABLES
    ss_bapiret2   = it_bapi_ret.

Variante 3 (C14ALD_BAPIRET2_SHOW)

* EHS: Anzeige einer BAPI-Fehlermeldungstabelle (BAPIRET2)
CALL FUNCTION 'C14ALD_BAPIRET2_SHOW'
  TABLES
    i_bapiret2_tab = it_bapi_ret.

Variante 4 (RSCRMBW_DISPLAY_BAPIRET2)

CALL FUNCTION 'RSCRMBW_DISPLAY_BAPIRET2'
    TABLES
      it_return = it_bapi_ret.

[ABAP] Zwei SALV-Grids in einem Splittercontainer anzeigen

* Daten für SALV-Grid oben
SELECT *
  INTO TABLE @DATA(it_scarr)
  FROM scarr.

* Daten für SALV-Grid unten
SELECT *
  INTO TABLE @DATA(it_sflight)
  FROM sflight.

* Referenzen auf GUI-Objekte
* Splitter
DATA: o_splitter_main TYPE REF TO cl_gui_splitter_container.
* Splitter-Container oben
DATA: o_container_o   TYPE REF TO cl_gui_container.
* Splitter-Container unten
DATA: o_container_u   TYPE REF TO cl_gui_container.

* Splitter auf default_screen erzeugen
o_splitter_main = NEW #( parent                  = cl_gui_container=>default_screen
                         no_autodef_progid_dynnr = abap_true       " wichtig
                         rows                    = 2
                         columns                 = 1 ).

* Höhe oberer Splitter in %
o_splitter_main->set_row_height( id = 1 height = 40 ).

* REF auf oberen und unteren Splitcontainer holen
o_container_o = o_splitter_main->get_container( row = 1 column = 1 ).
o_container_u = o_splitter_main->get_container( row = 2 column = 1 ).

* SALV-Table oben mit Fluggesellschaften
DATA: o_salv_o TYPE REF TO cl_salv_table.

cl_salv_table=>factory( EXPORTING
                          r_container  = o_container_o
                        IMPORTING
                          r_salv_table = o_salv_o
                        CHANGING
                          t_table      = it_scarr ).

* Grundeinstellungen
o_salv_o->get_functions( )->set_all( abap_true ).
o_salv_o->get_columns( )->set_optimize( abap_true ).
o_salv_o->get_display_settings( )->set_list_header( 'Fluggesellschaften' ).
o_salv_o->get_display_settings( )->set_striped_pattern( abap_true ).
o_salv_o->get_selections( )->set_selection_mode( if_salv_c_selection_mode=>row_column ).

* Spaltenüberschriften: technischer Name und Beschreibungstexte
LOOP AT o_salv_o->get_columns( )->get( ) ASSIGNING FIELD-SYMBOL(<so>).
  DATA(o_col_o) = <so>-r_column.
  o_col_o->set_short_text( || ).
  o_col_o->set_medium_text( || ).
  o_col_o->set_long_text( |{ o_col_o->get_columnname( ) }| ).
ENDLOOP.

* SALV-Grid anzeigen
o_salv_o->display( ).

* SALV-Table unten mit Flügen
DATA: o_salv_u TYPE REF TO cl_salv_table.

cl_salv_table=>factory( EXPORTING
                          r_container  = o_container_u
                        IMPORTING
                          r_salv_table = o_salv_u
                        CHANGING
                          t_table      = it_sflight ).

* Grundeinstellungen
o_salv_u->get_functions( )->set_all( abap_true ).
o_salv_u->get_columns( )->set_optimize( abap_true ).
o_salv_u->get_display_settings( )->set_list_header( 'Flüge' ).
o_salv_u->get_display_settings( )->set_striped_pattern( abap_true ).
o_salv_u->get_selections( )->set_selection_mode( if_salv_c_selection_mode=>row_column ).

* Spaltenüberschriften: technischer Name und Beschreibungstexte
LOOP AT o_salv_u->get_columns( )->get( ) ASSIGNING FIELD-SYMBOL(<su>).
  DATA(o_col_u) = <su>-r_column.
  o_col_u->set_short_text( || ).
  o_col_u->set_medium_text( || ).
  o_col_u->set_long_text( |{ o_col_u->get_columnname( ) }| ).
ENDLOOP.

* SALV-Grid anzeigen
o_salv_u->display( ).

* leere Toolbar ausblenden
cl_abap_list_layout=>suppress_toolbar( ).

* Erzwingen von cl_gui_container=>default_screen
WRITE: space.

[ABAP] Popupfenster mit Eingabefeldern (cl_gui_combobox, cl_gui_input_field)

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

    CLASS-METHODS:
      on_select FOR EVENT selected OF cl_gui_combobox
        IMPORTING
            key
            sender.

    CLASS-METHODS:
      on_submit FOR EVENT submit OF cl_gui_input_field
        IMPORTING
            input
            sender.

    CLASS-METHODS:
      on_auto_submit FOR EVENT auto_submit OF cl_gui_input_field
        IMPORTING
            input
            sender.
ENDCLASS.

CLASS lcl_events IMPLEMENTATION.
  METHOD on_close.
    IF sender IS NOT INITIAL.
      sender->free( ).
    ENDIF.
  ENDMETHOD.

  METHOD on_select.

    MESSAGE key && ' -> ' && sender->get_selected_item( ) TYPE 'S'.

    cl_gui_cfw=>flush( ).
  ENDMETHOD.

  METHOD on_submit.

    MESSAGE 'Submit:' && input && ' -> ' && sender->get_text( ) TYPE 'S'.

    cl_gui_cfw=>flush( ).
  ENDMETHOD.

  METHOD on_auto_submit.

    MESSAGE 'Auto-Submit:' &&  input && ' -> ' && sender->get_text( ) TYPE 'S'.

    cl_gui_cfw=>flush( ).
  ENDMETHOD.
ENDCLASS.

SELECTION-SCREEN: PUSHBUTTON 2(20) btn1 USER-COMMAND cmd_show.

AT SELECTION-SCREEN.
* wenn Button-Kommando 'CMD_SHOW'
  IF sy-ucomm = 'CMD_SHOW'.
* Container
    DATA(o_cnt) = NEW cl_gui_dialogbox_container( no_autodef_progid_dynnr = abap_true
                                                  caption                 = 'Werte'
                                                  top                     = 5
                                                  left                    = 5
                                                  width                   = 640
                                                  height                  = 240 ).

    SET HANDLER lcl_events=>on_close FOR o_cnt.

* Input
    DATA(o_input) = NEW cl_gui_input_field( parent               = o_cnt
                                            label_text           = 'InputLabel'
                                            label_width          = 10
                                            input_prompt_text    = 'Text'
                                            activate_find_button = abap_false
                                            activate_auto_submit = abap_true ).

    o_input->set_top( 30 ).
    o_input->set_text( '<default>' ).

    SET HANDLER lcl_events=>on_submit FOR o_input.
    SET HANDLER lcl_events=>on_auto_submit FOR o_input.

* Combobox
    DATA(o_combo) = NEW cl_gui_combobox( parent      = o_cnt
                                         label_text  = 'ComboLabel'
                                         label_width = 10 ).

    o_combo->set_items( VALUE vrm_values( ( key = 'A' text = 'Wert1' )
                                          ( key = 'B' text = 'Wert2' )
                                          ( key = 'C' text = 'Wert3' ) ) ).

    o_combo->set_selected_item( 'A' ).

    o_combo->activate_selection_event( ).

    o_combo->set_top( 10 ).

    SET HANDLER lcl_events=>on_select FOR o_combo.
  ENDIF.

[ABAP] Popup für Werteauswahl

TYPES: BEGIN OF ty_sel_list,
         l TYPE char100,
       END OF ty_sel_list.

TYPES: ty_it_sel_list TYPE STANDARD TABLE OF ty_sel_list WITH DEFAULT KEY.

TYPES: ty_it_rsvbfidesc TYPE STANDARD TABLE OF rsvbfidesc WITH DEFAULT KEY.

START-OF-SELECTION.

  DATA(lv_ln) = 0.

  DATA(it_sel_list) = VALUE ty_it_sel_list(
                                            ( l = 'Feld 1' )
                                            ( l = 'Feld 2' )
                                            ( l = 'Feld 3' )
                                            ( l = 'Feld 4' )
                                            ( l = 'Feld 5' )
                                          ).

  DATA(it_rsvbfidesc) = VALUE ty_it_rsvbfidesc( ( fieldnum = 1 display = abap_true ) ).

  CALL FUNCTION 'RS_VALUES_BOX'
    EXPORTING
      cursor_field         = 1
      cursor_line          = 1
      left_upper_col       = 10
      left_upper_row       = 5
      title                = 'Auswahl'
    IMPORTING
      linenumber           = lv_ln
    TABLES
      field_desc           = it_rsvbfidesc
      value_tab            = it_sel_list
    EXCEPTIONS
      clear_contents       = 1
      invalid_coordinates  = 2
      invalid_field_number = 3
      no_action            = 4
      no_fields            = 5
      no_markfield         = 6
      process_user_action  = 7
      value_tab_empty      = 8
      value_tab_too_long   = 9
      OTHERS               = 10.

  IF sy-subrc = 0.
    WRITE: / 'Auswahl:', lv_ln.
  ENDIF.

[ABAP] Popup für Ausgabe von einfachen Textlisten im Format der F1-Hilfe

* Anzeigetext
DATA(it_text) = VALUE tline_t( ( tdformat = 'U1' tdline = 'Zeile 1' )
                               ( tdformat = '' tdline = 'Zeile 2' )
                               ( tdformat = '' tdline = 'Zeile 3' ) ).

* Kommando bei Buttonklick
DATA: lv_ret_code TYPE sy-ucomm.

* Popup zur Anzeige einer Textliste (Texte in einer Tabelle)
* task: 'DECIDE':  Popup mit zwei Buttons 'Übernehmen' und 'Ändern'
*       'DISPLAY': Popup mit Ok- und Scrollbuttons
CALL FUNCTION 'COPO_POPUP_TO_DISPLAY_TEXTLIST'
  EXPORTING
    task       = 'DECIDE' " 'DISPLAY' oder 'DECIDE'
    titel      = 'Anzeige'
  IMPORTING
    function   = lv_ret_code
  TABLES
    text_table = it_text.

WRITE: / lv_ret_code.