[ABAP] Charts mit cl_gui_chart_engine / cl_gui_chart_engine_win anzeigen, ändern, laden und speichern (XML), Beispiel-Charts

Einleitung

Mit Hilfe der Klasse cl_gui_chart_engine können Charts generiert werden. Über XML-Dokumente kann die Anzeige konfiguriert bzw. Daten angezeigt werden. SAP liefert zur einfachen Konfiguration ein Tool namens Chart Designer. Die XML-Daten können aber auch manuell generiert werden, eine genaue Beschreibung findet man im Dokument „XML Format.pdf“ des Chart Designers.
Mit Hilfe des unten stehenden Demo-Programms können auch XML-Daten für das Customizing generiert, geladen und gespeichert sowie Plot-Daten im XML-Format eingeladen werden. Es sind auch zwei einfache Beispiele für einen Bar-Chart sowie einen Scatter-Plot implementiert.

ABAP-Demoprogramm

* Chart-Demoprogramme
* GRAPHICS_GUI_CE_DEMO
* GRAPHICS_IGS_CE_TEST
* RSORA_TCS_DEMO

* Chart-Klassen
* CL_GUI_CHART_ENGINE
* CL_IGS_CHART_ENGINE
* CL_TIME_CHART_SIMPLE

DATA: it_sflight TYPE STANDARD TABLE OF sflight.
* globales Chart-Objekt
DATA: o_chart TYPE REF TO cl_gui_chart_engine.

CLASS lcl_events DEFINITION.
  PUBLIC SECTION.

    TYPES: ty_it_events TYPE STANDARD TABLE OF cntl_simple_event WITH DEFAULT KEY.

* Buttons
    CONSTANTS: co_btn_load_cust TYPE string VALUE 'BTN_LOAD_CUST'.
    CONSTANTS: co_btn_load_data TYPE string VALUE 'BTN_LOAD_DATA'.
    CONSTANTS: co_btn_save_cust TYPE string VALUE 'BTN_SAVE_CUST'.
    CONSTANTS: co_btn_print TYPE string VALUE 'BTN_PRINT'.
    CONSTANTS: co_btn_example_bar TYPE string VALUE 'BTN_EXAMPLE_BAR'.
    CONSTANTS: co_btn_example_scatter TYPE string VALUE 'BTN_EXAMPLE_SCATTER'.
    CONSTANTS: co_btn_clear TYPE string VALUE 'BTN_CLEAR'.

    CLASS-METHODS: on_click FOR EVENT click OF cl_gui_chart_engine
      IMPORTING
          element
          series
          point
          sender.
    CLASS-METHODS: on_value_change FOR EVENT value_change OF cl_gui_chart_engine
      IMPORTING
          series
          point
          value
          sender.
    CLASS-METHODS: on_property_change FOR EVENT property_change OF cl_gui_chart_engine
      IMPORTING
          element
          name
          value
          sender.

    CLASS-METHODS:
      on_function_selected FOR EVENT function_selected OF cl_gui_toolbar
        IMPORTING
            fcode
            sender.
ENDCLASS.

CLASS lcl_events IMPLEMENTATION.
* Klick auf Chart
  METHOD on_click.
    MESSAGE |Klick: { element } { series } { point }| TYPE 'S'.
  ENDMETHOD.

* Chart Wertänderung
  METHOD on_value_change.
    MESSAGE |Wert geändert: { series } { point } { value }| TYPE 'S'.
  ENDMETHOD.

* Chart Property-Änderung
  METHOD on_property_change.
    MESSAGE |Property: { element } { name } { value }| TYPE 'S'.
  ENDMETHOD.

* Toolbar Button geklickt
  METHOD on_function_selected.

    CASE fcode.
* Graph drucken
      WHEN co_btn_print.
        IF o_chart IS BOUND.
          DATA(o_cewp) = CAST cl_gui_chart_engine_win( o_chart->get_control( ) ).
          o_cewp->print( ).
        ENDIF.
* Graph zurücksetzen
      WHEN co_btn_clear.
        IF o_chart IS BOUND.
* Initialdaten setzen
          o_chart->set_data( data = '<?xml version="1.0" encoding="utf-8"?><SimpleChartData></SimpleChartData>' ).
* Initial-Customizing setzen
          o_chart->set_customizing( data = '<?xml version="1.0" encoding="utf-8"?><SAPChartCustomizing version="2.0"></SAPChartCustomizing>' ).
        ENDIF.
**********************************************************************
* Bargraph
* einfaches Balkendiagramm, bei dem jeweils 2 Punkte einer Series
* einer Kategorie zugeordnet werden
**********************************************************************
      WHEN co_btn_example_bar.
        IF o_chart IS BOUND.
* Initialdaten setzen
          o_chart->set_data( data_table = VALUE w3htmltabtype( ( |<?xml version="1.0" encoding="utf-8"?>| )
                                                               ( |<ChartData>| )
                                                               ( |  <Categories>| )
                                                               ( |    <Category>Category 1</Category>| )
                                                               ( |    <Category>Category 2</Category>| )
                                                               ( |    <Category>Category 3</Category>| )
                                                               ( |  </Categories>| )
                                                               ( |  <Series customizing="Series1" label="Series 1">| )
                                                               ( |    <Point>| )
                                                               ( |      <Value type="y">5</Value>| )
                                                               ( |    </Point>| )
                                                               ( |    <Point>| )
                                                               ( |      <Value type="y">10</Value>| )
                                                               ( |    </Point>| )
                                                               ( |    <Point>| )
                                                               ( |      <Value type="y">7</Value>| )
                                                               ( |    </Point>| )
                                                               ( |  </Series>| )
                                                               ( |  <Series customizing="Series2" label="Series 2">| )
                                                               ( |    <Point>| )
                                                               ( |      <Value type="y">7</Value>| )
                                                               ( |    </Point>| )
                                                               ( |    <Point>| )
                                                               ( |      <Value type="y">9</Value>| )
                                                               ( |    </Point>| )
                                                               ( |    <Point>| )
                                                               ( |      <Value type="y">23</Value>| )
                                                               ( |    </Point>| )
                                                               ( |  </Series>| )
                                                               ( |</ChartData>| ) ) ).
* Initial-Customizing setzen
          o_chart->set_customizing( data_table = VALUE w3htmltabtype( ( |<?xml version="1.0" encoding="utf-8"?>| )
                                                                      ( |<SAPChartCustomizing version="2.0">| )
                                                                      ( | <GlobalSettings>| )
                                                                      ( |  <Defaults>| )
                                                                      ( |   <ChartType>Columns</ChartType>| )
                                                                      ( |   <FontFamily>Arial</FontFamily>| )
                                                                      ( |  </Defaults>| )
                                                                      ( | </GlobalSettings>| )
                                                                      ( | <Elements>| )
                                                                      ( |  <ChartElements>| )
                                                                      ( |   <Title>| )
                                                                      ( |    <Caption>Bargraph</Caption>| )
                                                                      ( |   </Title>| )
                                                                      ( |  </ChartElements>| )
                                                                      ( | </Elements>| )
                                                                      ( |</SAPChartCustomizing>| ) ) ).
        ENDIF.
**********************************************************************
* Scatterplot
* x,y-Punkte-Diagramm mit zwei Linien (Series)
* Vorgabe von Achse (min, max), Punkteigenschaften, Farbe, Legende
**********************************************************************
      WHEN co_btn_example_scatter.
        IF o_chart IS BOUND.
* Initialdaten setzen
          o_chart->set_data( data_table = VALUE w3htmltabtype( ( |<?xml version="1.0" encoding="utf-8"?>| )
                                                               ( |<ChartData>| )
                                                               ( |  <Series customizing="Series1" label="y1">| )
                                                               ( |    <Point label="P1">| )
                                                               ( |      <Value type="x">-5.1</Value>| )
                                                               ( |      <Value type="y">-2.3</Value>| )
                                                               ( |    </Point>| )
                                                               ( |    <Point label="P2">| )
                                                               ( |      <Value type="x">1.2</Value>| )
                                                               ( |      <Value type="y">1.1</Value>| )
                                                               ( |    </Point>| )
                                                               ( |    <Point label="P3">| )
                                                               ( |      <Value type="x">6.2</Value>| )
                                                               ( |      <Value type="y">7.4</Value>| )
                                                               ( |    </Point>| )
                                                               ( |  </Series>| )
                                                               ( |  <Series customizing="Series2" label="y2">| )
                                                               ( |    <Point label="P1">| )
                                                               ( |      <Value type="x">-5.1</Value>| )
                                                               ( |      <Value type="y">0.3</Value>| )
                                                               ( |    </Point>| )
                                                               ( |    <Point label="P2">| )
                                                               ( |      <Value type="x">1.2</Value>| )
                                                               ( |      <Value type="y">3.5</Value>| )
                                                               ( |    </Point>| )
                                                               ( |    <Point label="P3">| )
                                                               ( |      <Value type="x">6.2</Value>| )
                                                               ( |      <Value type="y">8.9</Value>| )
                                                               ( |    </Point>| )
                                                               ( |  </Series>| )
                                                               ( |</ChartData>| ) ) ).
* Initial-Customizing setzen
          o_chart->set_customizing( data_table = VALUE w3htmltabtype( ( |<?xml version="1.0" encoding="utf-8"?>| )
                                                                      ( |<SAPChartCustomizing version="2.0">| )
                                                                      ( | <GlobalSettings>| )
                                                                      ( |  <Dimension>Two</Dimension>| )
                                                                      ( |  <ColorPalette>Tradeshow</ColorPalette>| )
                                                                      ( |  <Defaults>| )
                                                                      ( |   <ChartType>Scatter</ChartType>| )
                                                                      ( |   <FontFamily>Arial</FontFamily>| )
                                                                      ( |  </Defaults>| )
                                                                      ( | </GlobalSettings>| )
                                                                      ( | <Elements>| )
                                                                      ( |  <ChartElements>| )
                                                                      ( |   <Title>| )
                                                                      ( |    <Caption>Scatterplot</Caption>| )
                                                                      ( |   </Title>| )
                                                                      ( |   <Subtitle>| )
                                                                      ( |    <Caption>Daten und Settings</Caption>| )
                                                                      ( |   </Subtitle>| )
                                                                      ( |   <Legend>| )
                                                                      ( |    <Alignment>ToPlotArea</Alignment>| )
                                                                      ( |    <Position>TopRight</Position>| )
                                                                      ( |   </Legend>| )
                                                                      ( |  </ChartElements>| )
                                                                      ( |  <ChartAxes>| )
                                                                      ( |   <ValueAxis id="ValueAxis1">| )
                                                                      ( |    <Visibility>true</Visibility>| )
                                                                      ( |    <Minimum>-10</Minimum>| )
                                                                      ( |    <MinimumCalculation>UserDefined</MinimumCalculation>| )
                                                                      ( |    <Maximum>10</Maximum>| )
                                                                      ( |    <MaximumCalculation>UserDefined</MaximumCalculation>| )
                                                                      ( |    <ScalingType>Linear</ScalingType>| )
                                                                      ( |    <Order>Ascending</Order>| )
                                                                      ( |    <Position>Primary</Position>| )
                                                                      ( |    <Title>| )
                                                                      ( |     <Caption>x</Caption>| )
                                                                      ( |    </Title>| )
                                                                      ( |   </ValueAxis>| )
                                                                      ( |   <ValueAxis id="ValueAxis2">| )
                                                                      ( |    <Visibility>true</Visibility>| )
                                                                      ( |    <Minimum>-10</Minimum>| )
                                                                      ( |    <MinimumCalculation>UserDefined</MinimumCalculation>| )
                                                                      ( |    <Maximum>10</Maximum>| )
                                                                      ( |    <MaximumCalculation>UserDefined</MaximumCalculation>| )
                                                                      ( |    <ScalingType>Linear</ScalingType>| )
                                                                      ( |    <Order>Ascending</Order>| )
                                                                      ( |    <Position>Primary</Position>| )
                                                                      ( |    <Title>| )
                                                                      ( |     <Caption>x</Caption>| )
                                                                      ( |    </Title>| )
                                                                      ( |   </ValueAxis>| )
                                                                      ( |  </ChartAxes>| )
                                                                      ( | </Elements>| )
                                                                      ( | <Values>| )
                                                                      ( |  <Series>| )
                                                                      ( |   <ShowLabel>true</ShowLabel>| )
                                                                      ( |   <LineColor>@20</LineColor>| )
                                                                      ( |  </Series>| )
                                                                      ( |  <Series id="Series1">| )
                                                                      ( |   <ShowLabel>true</ShowLabel>| )
                                                                      ( |   <LineColor>@20</LineColor>| )
                                                                      ( |   <Color>@20</Color>| )
                                                                      ( |  </Series>| )
                                                                      ( |  <Series id="Series2">| )
                                                                      ( |   <ShowLabel>true</ShowLabel>| )
                                                                      ( |   <LineColor>@60</LineColor>| )
                                                                      ( |   <Color>@60</Color>| )
                                                                      ( |  </Series>| )
                                                                      ( | </Values>| )
                                                                      ( |</SAPChartCustomizing>| ) ) ).
        ENDIF.
* XML Chart-Customizing speichern
      WHEN co_btn_save_cust.
        IF o_chart IS BOUND.
          DATA: it_xml TYPE w3htmltabtype.

          DATA(o_cew_save) = CAST cl_gui_chart_engine_win( o_chart->get_control( ) ).
          o_cew_save->get_customizing( IMPORTING data_table = it_xml ).

          DATA: lv_action TYPE i.
          DATA: lv_filename TYPE string.
          DATA: lv_fullpath TYPE string.
          DATA: lv_path TYPE string.

          TRY.
* Savedialog anzeigen
              cl_gui_frontend_services=>file_save_dialog( EXPORTING
                                                            default_file_name = 'chart.xml'
                                                            default_extension = 'xml'
                                                            file_filter       = |XML (*.xml)\|*.xml\|{ cl_gui_frontend_services=>filetype_all }|
                                                          CHANGING
                                                            filename          = lv_filename
                                                            path              = lv_path
                                                            fullpath          = lv_fullpath
                                                            user_action       = lv_action ).

              IF lv_action EQ cl_gui_frontend_services=>action_ok.

* XML-Daten lokal speichern
                cl_gui_frontend_services=>gui_download( EXPORTING
                                                          filename = lv_fullpath
                                                          filetype = 'BIN'
                                                        CHANGING
                                                          data_tab = it_xml ).

              ENDIF.
            CATCH cx_root INTO DATA(e_txt).
              MESSAGE e_txt->get_text( ) TYPE 'E'.
          ENDTRY.
        ENDIF.
* XML Chart-Customizing laden
      WHEN co_btn_load_cust.
        IF o_chart IS BOUND.
          DATA: lv_rc_cust TYPE i.
          DATA: it_files_cust TYPE filetable.
          DATA: lv_action_open_cust TYPE i.

* FileOpen-Dialog aufrufen
          TRY.
              cl_gui_frontend_services=>file_open_dialog( EXPORTING
                                                            file_filter = |XML (*.xml)\|*.xml\|{ cl_gui_frontend_services=>filetype_all }|
                                                          CHANGING
                                                            file_table  = it_files_cust
                                                            rc          = lv_rc_cust
                                                            user_action = lv_action_open_cust ).

              IF lv_action_open_cust = cl_gui_frontend_services=>action_ok.
* wenn Datei ausgewählt wurde
                IF lines( it_files_cust ) > 0.

                  DATA: lv_filesize_cust TYPE w3param-cont_len.
                  DATA: it_xml_cust_up TYPE w3htmltabtype.

                  cl_gui_frontend_services=>gui_upload( EXPORTING
                                                          filename   = |{ it_files_cust[ 1 ]-filename }|
                                                          filetype   = 'BIN'
                                                        IMPORTING
                                                          filelength = lv_filesize_cust
                                                        CHANGING
                                                          data_tab   = it_xml_cust_up ).

* XML-Daten setzen
                  o_chart->set_customizing( data_table = it_xml_cust_up ).

                ENDIF.
              ENDIF.

            CATCH cx_root INTO DATA(e_text_cust).
              MESSAGE e_text_cust->get_text( ) TYPE 'S' DISPLAY LIKE 'E'.
          ENDTRY.

        ENDIF.
* XML Chart-Daten laden
      WHEN co_btn_load_data.
        IF o_chart IS BOUND.
          DATA: lv_rc_data TYPE i.
          DATA: it_files_data TYPE filetable.
          DATA: lv_action_open_data TYPE i.

* FileOpen-Dialog aufrufen
          TRY.
              cl_gui_frontend_services=>file_open_dialog( EXPORTING
                                                            file_filter = |XML (*.xml)\|*.xml\|{ cl_gui_frontend_services=>filetype_all }|
                                                          CHANGING
                                                            file_table  = it_files_data
                                                            rc          = lv_rc_data
                                                            user_action = lv_action_open_data ).

              IF lv_action_open_data = cl_gui_frontend_services=>action_ok.
* wenn Datei ausgewählt wurde
                IF lines( it_files_data ) > 0.

                  DATA: lv_filesize_data TYPE w3param-cont_len.
                  DATA: it_xml_data_up TYPE w3htmltabtype.

                  cl_gui_frontend_services=>gui_upload( EXPORTING
                                                          filename   = |{ it_files_data[ 1 ]-filename }|
                                                          filetype   = 'BIN'
                                                        IMPORTING
                                                          filelength = lv_filesize_data
                                                        CHANGING
                                                          data_tab   = it_xml_data_up ).

* XML-Daten setzen
                  o_chart->set_data( data_table = it_xml_data_up ).

                ENDIF.
              ENDIF.

            CATCH cx_root INTO DATA(e_text_data).
              MESSAGE e_text_data->get_text( ) TYPE 'S' DISPLAY LIKE 'E'.
          ENDTRY.

        ENDIF.
    ENDCASE.
  ENDMETHOD.
ENDCLASS.

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

* absoluter Modus für Zeilenhöhe
  o_splitter->set_row_mode( mode = cl_gui_splitter_container=>mode_absolute ).

* Höhe absolut 24 Pixel für Splitter oben
  o_splitter->set_row_height( id = 1 height = 24 ).

* Splitter für oberen Container fest und verborgen
  o_splitter->set_row_sash( id = 1
                            type = cl_gui_splitter_container=>type_movable
                            value = cl_gui_splitter_container=>false ).

  o_splitter->set_row_sash( id = 1
                            type = cl_gui_splitter_container=>type_sashvisible
                            value = cl_gui_splitter_container=>false ).

* Top- und Bottom-Container holen
  DATA(o_container_top) = o_splitter->get_container( row = 1 column = 1 ).
  DATA(o_container_bottom) = o_splitter->get_container( row = 2 column = 1 ).

* Toolbar hoizontal
  DATA(o_tool) = NEW cl_gui_toolbar( parent       = o_container_top
                                     display_mode = cl_gui_toolbar=>m_mode_horizontal ).

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

  o_tool->set_registered_events( events = it_events ).

* Toolbar-Buttons hinzufügen
* Buttontypen sind in Typgruppe CNTB definiert
  o_tool->add_button( fcode       = CONV #( lcl_events=>co_btn_load_cust )
                      icon        = icon_open
                      butn_type   = cntb_btype_button
                      text        = 'Load settings'
                      quickinfo   = 'Load chart settings'
                      is_checked  = abap_false
                      is_disabled = abap_false ).

  o_tool->add_button( fcode       = ''
                      icon        = ''
                      butn_type   = cntb_btype_sep
                      text        = ''
                      quickinfo   = ''
                      is_checked  = abap_false
                      is_disabled = abap_false ).

  o_tool->add_button( fcode       = CONV #( lcl_events=>co_btn_save_cust )
                      icon        = icon_system_save
                      butn_type   = cntb_btype_button
                      text        = 'Save settings'
                      quickinfo   = 'Save chart settings'
                      is_checked  = abap_false
                      is_disabled = abap_false ).

  o_tool->add_button( fcode       = ''
                      icon        = ''
                      butn_type   = cntb_btype_sep
                      text        = ''
                      quickinfo   = ''
                      is_checked  = abap_false
                      is_disabled = abap_false ).

  o_tool->add_button( fcode       = CONV #( lcl_events=>co_btn_load_data )
                      icon        = icon_open
                      butn_type   = cntb_btype_button
                      text        = 'Load data'
                      quickinfo   = 'Load chart data'
                      is_checked  = abap_false
                      is_disabled = abap_false ).

  o_tool->add_button( fcode       = ''
                      icon        = ''
                      butn_type   = cntb_btype_sep
                      text        = ''
                      quickinfo   = ''
                      is_checked  = abap_false
                      is_disabled = abap_false ).

  o_tool->add_button( fcode       = CONV #( lcl_events=>co_btn_example_bar )
                      icon        = icon_display
                      butn_type   = cntb_btype_button
                      text        = 'Beispiel Bargraph'
                      quickinfo   = 'Beispieldaten + Settings'
                      is_checked  = abap_false
                      is_disabled = abap_false ).

  o_tool->add_button( fcode       = ''
                      icon        = ''
                      butn_type   = cntb_btype_sep
                      text        = ''
                      quickinfo   = ''
                      is_checked  = abap_false
                      is_disabled = abap_false ).

  o_tool->add_button( fcode       = CONV #( lcl_events=>co_btn_example_scatter )
                      icon        = icon_display
                      butn_type   = cntb_btype_button
                      text        = 'Beispiel Scatterplot'
                      quickinfo   = 'Beispieldaten + Settings'
                      is_checked  = abap_false
                      is_disabled = abap_false ).

  o_tool->add_button( fcode       = ''
                      icon        = ''
                      butn_type   = cntb_btype_sep
                      text        = ''
                      quickinfo   = ''
                      is_checked  = abap_false
                      is_disabled = abap_false ).

  o_tool->add_button( fcode       = CONV #( lcl_events=>co_btn_clear )
                      icon        = icon_delete
                      butn_type   = cntb_btype_button
                      text        = 'Löschen'
                      quickinfo   = 'Alles löschen'
                      is_checked  = abap_false
                      is_disabled = abap_false ).

  o_tool->add_button( fcode       = ''
                      icon        = ''
                      butn_type   = cntb_btype_sep
                      text        = ''
                      quickinfo   = ''
                      is_checked  = abap_false
                      is_disabled = abap_false ).

  o_tool->add_button( fcode       = CONV #( lcl_events=>co_btn_print )
                      icon        = icon_print
                      butn_type   = cntb_btype_button
                      text        = 'Drucken'
                      quickinfo   = 'Chart drucken'
                      is_checked  = abap_false
                      is_disabled = abap_false ).

* Eventhandler registrieren
  SET HANDLER lcl_events=>on_function_selected FOR o_tool.

**********************************************************************
* Chart
**********************************************************************
* Daten holen
  SELECT * FROM sflight INTO TABLE it_sflight UP TO 10 ROWS.

* Chart in unteren GUI-Container einbetten
  o_chart = NEW #( parent = o_container_bottom ).

**********************************************************************
* Chart-Daten generieren
**********************************************************************
* leere Defaultdaten übergeben
  DATA(it_xml_data) = VALUE w3htmltabtype( ).
  o_chart->set_data( data_table = it_xml_data ).

**********************************************************************
* Chart-Customizing generieren
**********************************************************************
* leere Defaultdaten übergeben
  DATA(it_xml_customizing) = VALUE w3htmltabtype( ).
  o_chart->set_customizing( data_table = it_xml_customizing ).

**********************************************************************
* zus. Einstellungen
**********************************************************************
* Einstellungsdialoge anzeigen
  DATA(o_adj) = CAST cl_gui_chart_engine_win( o_chart->get_control( ) ).
* Design-Anpassungen ermöglichen
  o_adj->set_design_mode( flag = abap_true event = abap_true ).
* Einstellmöglichkeiten beschränken
*  o_adj->restrict_chart_types( charttypes = 'Columns|Lines' ).
*  o_adj->restrict_property_events( events = 'ChartType' ).

* Wertänderungen ermöglichen
  o_adj->enable_value_change( ).

* Event-Handler registrieren
  SET HANDLER lcl_events=>on_click FOR o_chart.
  SET HANDLER lcl_events=>on_value_change FOR o_chart.
  SET HANDLER lcl_events=>on_property_change FOR o_chart.

* Graph anzeigen
  o_chart->render( ).

* leere Toolbar ausblenden
  cl_abap_list_layout=>suppress_toolbar( ).

* cl_gui_container=>default_screen erzingen
  WRITE: / space.

Weitere XML-Beispiele

Customizing für Scatter-Plot

<?xml version="1.0" encoding="utf-8"?>
<SAPChartCustomizing version="2.0">
 <GlobalSettings>
  <Dimension>Two</Dimension>
  <Defaults>
   <ChartType>Scatter</ChartType>
   <FontFamily>Arial</FontFamily>
  </Defaults>
 </GlobalSettings>
 <Elements>
  <ChartElements>
   <Title>
    <Caption>Beispiel-Titel</Caption>
   </Title>
   <Subtitle>
    <Caption>Untertitel</Caption>
   </Subtitle>
   <Legend>
    <Alignment>ToPlotArea</Alignment>
    <Position>Right</Position>
   </Legend>
  </ChartElements>
  <ChartAxes>
   <ValueAxis id="ValueAxis1">
    <Visibility>true</Visibility>
    <MinimumCalculation>Automatic</MinimumCalculation>
    <MaximumCalculation>Automatic</MaximumCalculation>
    <ScalingType>Linear</ScalingType>
    <Order>Ascending</Order>
    <Position>Primary</Position>
    <Title>
     <Caption>x</Caption>
    </Title>
   </ValueAxis>
  </ChartAxes>
 </Elements>
</SAPChartCustomizing>

Daten für Scatter-Plot

<?xml version="1.0" encoding="utf-8"?>
<ChartData>
  <Categories>
    <Category>Category 1</Category>
  </Categories>
  <Series customizing="Series1" label="y">
    <Point label="P1">
      <Value type="x">0</Value>
      <Value type="y">5</Value>
    </Point>
    <Point label="P2">
      <Value type="x">1</Value>
      <Value type="y">10</Value>
    </Point>
    <Point label="P3">
      <Value type="x">2</Value>
      <Value type="y">7</Value>
    </Point>
  </Series>
</ChartData>

Customizing für Bar-Chart

<?xml version="1.0" encoding="utf-8"?>
<SAPChartCustomizing version="2.0">
 <GlobalSettings>
  <Defaults>
   <ChartType>Columns</ChartType>
   <FontFamily>Arial</FontFamily>
  </Defaults>
 </GlobalSettings>
 <Elements>
  <ChartElements>
   <Title>
    <Visibility>true</Visibility>
    <Caption>Caption1</Caption>
   </Title>
  </ChartElements>
 </Elements>
</SAPChartCustomizing>

Daten für Bar-Chart

<?xml version="1.0" encoding="utf-8"?>
<ChartData>
  <Categories>
    <Category>Category 1</Category>
    <Category>Category 2</Category>
    <Category>Category 3</Category>
  </Categories>
  <Series customizing="Series1" label="Series 1">
    <Point>
      <Value type="y">5</Value>
    </Point>
    <Point>
      <Value type="y">10</Value>
    </Point>
    <Point>
      <Value type="y">7</Value>
    </Point>
  </Series>
  <Series customizing="Series2" label="Series 2">
    <Point>
      <Value type="y">7</Value>
    </Point>
    <Point>
      <Value type="y">9</Value>
    </Point>
    <Point>
      <Value type="y">23</Value>
    </Point>
  </Series>
</ChartData>

Weiterführende Infos

Easy Charts
Creating Charts
abapblog.com
catmull rom
Custom Chart Creation

[ABAP] GUI-Toolbar mit statischem Context-Menü, Eventhandling

TYPES: ty_it_events TYPE STANDARD TABLE OF cntl_simple_event WITH DEFAULT KEY.

CLASS lcl_events DEFINITION.
  PUBLIC SECTION.
    CLASS-METHODS:
      on_function_selected FOR EVENT function_selected OF cl_gui_toolbar
        IMPORTING
            fcode
            sender.
ENDCLASS.

CLASS lcl_events IMPLEMENTATION.
* Toolbar: Button oder Menüpunkt geklickt
  METHOD on_function_selected.

* Funktionscode auswerten
    CASE fcode.
      WHEN 'BTN_CLOSE'.
        LEAVE PROGRAM.
      WHEN 'M1'.
      WHEN 'M2'.
    ENDCASE.

* fcode ausgeben
    MESSAGE fcode TYPE 'S'.

  ENDMETHOD.
ENDCLASS.

INITIALIZATION.

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

* Absoluter Modus für Zeilenhöhe
  o_splitter->set_row_mode( mode = cl_gui_splitter_container=>mode_absolute ).

* Höhe absolut 24 Pixel für Splitter oben
  o_splitter->set_row_height( id = 1 height = 24 ).

* Splitter für oberen Container fest und verborgen
  o_splitter->set_row_sash( id    = 1
                            type  = cl_gui_splitter_container=>type_movable
                            value = cl_gui_splitter_container=>false ).

  o_splitter->set_row_sash( id    = 1
                            type  = cl_gui_splitter_container=>type_sashvisible
                            value = cl_gui_splitter_container=>false ).

  DATA(o_container_top) = o_splitter->get_container( row = 1 column = 1 ).
  DATA(o_container_bottom) = o_splitter->get_container( row = 2 column = 1 ).

* Toolbar hoizontal
  DATA(o_tool) = NEW cl_gui_toolbar( parent       = o_container_top
                                     display_mode = cl_gui_toolbar=>m_mode_horizontal ).

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

  o_tool->set_registered_events( events = it_events ).

* Toolbar-Buttons und Menüs hinzufügen
* Buttontypen sind in Typgruppe CNTB definiert
  o_tool->add_button( fcode       = 'BTN_MENU'
                      icon        = icon_activate
                      butn_type   = cntb_btype_menu
                      text        = 'Menü'
                      quickinfo   = 'Menü anzeigen'
                      is_checked  = abap_false
                      is_disabled = abap_false ).

* statisches Kontextmenü für Button "BTN_MENU" erstellen
  DATA(o_menu) = NEW cl_ctmenu( ).
  o_menu->add_function( fcode   = 'M1'
                        checked = abap_false
                        text    = 'Punkt1' ).

  o_menu->add_function( fcode   = 'M2'
                        checked = abap_false
                        text    = 'Punkt2' ).

* statisches Kontextmenü mit Button verknüpfen, Zuordnung erfolgt über den Namen
* daher muss "function" gleich "fcode" des Menü-Buttons sein, sonst Exception
  DATA(it_ctxmenu) = VALUE ttb_btnmnu( ( function = 'BTN_MENU'
                                         ctmenu   = o_menu ) ).

* siehe auch Methode "set_static_ctxmenu"
  o_tool->assign_static_ctxmenu_table( it_ctxmenu ).

* Separator
  o_tool->add_button( fcode       = ''
                      icon        = ''
                      butn_type   = cntb_btype_sep
                      text        = ''
                      quickinfo   = ''
                      is_checked  = abap_false
                      is_disabled = abap_false ).

* Schließen-Button
  o_tool->add_button( fcode       = 'BTN_CLOSE'
                      icon        = icon_close
                      butn_type   = cntb_btype_button
                      text        = 'Schließen'
                      quickinfo   = 'Schließen'
                      is_checked  = abap_false
                      is_disabled = abap_false ).

* Eventhandler registrieren
  SET HANDLER lcl_events=>on_function_selected FOR o_tool.

* im unteren 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_bottom
                          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.

[ABAP] GUI-Toolbar mit dynamischen Context-Menü, Eventhandling, Umschaltung checked-state

TYPES: ty_it_events TYPE STANDARD TABLE OF cntl_simple_event WITH DEFAULT KEY.

TYPES: BEGIN OF ty_menuitem,
         fcode   TYPE ui_func,
         checked TYPE cua_active,
         text    TYPE gui_text,
       END OF ty_menuitem.

TYPES: ty_it_menuitems TYPE STANDARD TABLE OF ty_menuitem WITH DEFAULT KEY.

DATA: it_menuitems TYPE ty_it_menuitems.

CLASS lcl_events DEFINITION.
  PUBLIC SECTION.
    CLASS-METHODS:
      on_function_selected FOR EVENT function_selected OF cl_gui_toolbar
        IMPORTING
            fcode
            sender.
    CLASS-METHODS:
      on_dropdown_clicked FOR EVENT dropdown_clicked OF cl_gui_toolbar
        IMPORTING
            fcode
            posx
            posy
            sender.
ENDCLASS.

CLASS lcl_events IMPLEMENTATION.
* Toolbar: Button oder Menüpunktgeklickt
  METHOD on_function_selected.

* Checked-Status eines Dropdown-Menüpunktes umschalten
    IF line_exists( it_menuitems[ fcode = fcode ] ).
      ASSIGN it_menuitems[ fcode = fcode ] TO FIELD-SYMBOL(<mc>).
      <mc>-checked = COND #( WHEN <mc>-checked = abap_true THEN abap_false ELSE abap_true ).
    ENDIF.

* Funktionscode auswerten
    CASE fcode.
      WHEN 'BTN_CLOSE'.
        LEAVE PROGRAM.
      WHEN 'BTN_DROP'.
      WHEN 'M1'.
      WHEN 'M2'.
    ENDCASE.

* fcode ausgeben
    MESSAGE fcode TYPE 'S'.

  ENDMETHOD.
* Toolbar: Dropdown aktiviert
  METHOD on_dropdown_clicked.
* Menü erzeugen
    DATA(o_ctx_menu) = NEW cl_ctmenu( ).

    LOOP AT it_menuitems ASSIGNING FIELD-SYMBOL(<m>).
      o_ctx_menu->add_function( fcode   = <m>-fcode
                                checked = <m>-checked
                                text    = <m>-text ).
    ENDLOOP.

* Kontextmenü an der akt. Position anzeigen
    sender->track_context_menu( context_menu = o_ctx_menu
                                posx         = posx
                                posy         = posy ).
  ENDMETHOD.
ENDCLASS.

INITIALIZATION.

  it_menuitems = VALUE #( ( fcode   = 'M1'
                            checked = abap_false
                            text    = 'Punkt1' )
                          ( fcode   = 'M2'
                            checked = abap_true
                            text    = 'Punkt2' ) ).

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

* Absoluter Modus für Zeilenhöhe
  o_splitter->set_row_mode( mode = cl_gui_splitter_container=>mode_absolute ).

* Höhe absolut 24 Pixel für Splitter oben
  o_splitter->set_row_height( id = 1 height = 24 ).

* Splitter für oberen Container fest und verborgen
  o_splitter->set_row_sash( id = 1
                            type = cl_gui_splitter_container=>type_movable
                            value = cl_gui_splitter_container=>false ).

  o_splitter->set_row_sash( id = 1
                            type = cl_gui_splitter_container=>type_sashvisible
                            value = cl_gui_splitter_container=>false ).

  DATA(o_container_top) = o_splitter->get_container( row = 1 column = 1 ).
  DATA(o_container_bottom) = o_splitter->get_container( row = 2 column = 1 ).

* Toolbar hoizontal
  DATA(o_tool) = NEW cl_gui_toolbar( parent = o_container_top
                                     display_mode = cl_gui_toolbar=>m_mode_horizontal ).

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

  o_tool->set_registered_events( events = it_events ).

* Toolbar-Buttons hinzufügen
* Buttontypen sind in Typgruppe CNTB definiert
  o_tool->add_button( fcode       = 'BTN_DROP'
                      icon        = icon_activate
                      butn_type   = cntb_btype_dropdown
                      text        = 'Menü'
                      quickinfo   = 'Menü anzeigen'
                      is_checked  = abap_false
                      is_disabled = abap_false ).

  o_tool->add_button( fcode       = ''
                      icon        = ''
                      butn_type   = cntb_btype_sep
                      text        = ''
                      quickinfo   = ''
                      is_checked  = abap_false
                      is_disabled = abap_false ).

  o_tool->add_button( fcode       = 'BTN_CLOSE'
                      icon        = icon_close
                      butn_type   = cntb_btype_button
                      text        = 'Schließen'
                      quickinfo   = 'Schließen'
                      is_checked  = abap_false
                      is_disabled = abap_false ).

* Eventhandler registrieren
  SET HANDLER lcl_events=>on_function_selected FOR o_tool.
  SET HANDLER lcl_events=>on_dropdown_clicked FOR o_tool.

* im unteren 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_bottom
                          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.

Weiterführender Link zur Ideen-Quelle: Link

[ABAP] Erweiterte Baumansicht mit einem cl_gui_column_tree, Eventhandling

* Demoprogramm: SAPCOLUMN_TREE_CONTROL_DEMO

CONSTANTS: co_root TYPE tv_nodekey VALUE 'Root'.
CONSTANTS: co_auart TYPE tv_itmname VALUE 'Auftragsart'.
CONSTANTS: co_matnr TYPE tv_itmname VALUE 'Mat.-Nr.'.
CONSTANTS: co_arktx TYPE tv_itmname VALUE 'Kurztext'.
CONSTANTS: co_netwr TYPE tv_itmname VALUE 'Wert'.
CONSTANTS: co_flag TYPE tv_itmname VALUE 'Flag'.

DATA: it_nodes TYPE treev_ntab.
DATA: it_items TYPE STANDARD TABLE OF mtreeitm WITH DEFAULT KEY.

TYPES: ty_it_events TYPE STANDARD TABLE OF cntl_simple_event WITH DEFAULT KEY.

TYPES: BEGIN OF ty_vbak_vbap,
         auart TYPE vbak-auart,
         vbeln TYPE vbak-vbeln,
         posnr TYPE vbap-posnr,
         matnr TYPE vbap-matnr,
         arktx TYPE vbap-arktx,
         netwr TYPE vbap-netwr,
         flag  TYPE boolean,
       END OF ty_vbak_vbap.

TYPES: ty_it_vbak_vbap TYPE STANDARD TABLE OF ty_vbak_vbap WITH DEFAULT KEY.

* Eventhandlerklasse
CLASS lcl_event DEFINITION.
  PUBLIC SECTION.
    CLASS-METHODS: on_node_double_click FOR EVENT node_double_click OF cl_gui_column_tree
      IMPORTING
          node_key
          sender.
    CLASS-METHODS: on_item_double_click FOR EVENT item_double_click OF cl_gui_column_tree
      IMPORTING
          node_key
          item_name
          sender.
    CLASS-METHODS: on_expand_no_children FOR EVENT expand_no_children OF cl_gui_column_tree
      IMPORTING
          node_key
          sender.
    CLASS-METHODS: on_header_click FOR EVENT header_click OF cl_gui_column_tree
      IMPORTING
          header_name
          sender.
    CLASS-METHODS: on_button_click FOR EVENT button_click OF cl_gui_column_tree
      IMPORTING
          node_key
          item_name
          sender.
    CLASS-METHODS: on_link_click FOR EVENT link_click OF cl_gui_column_tree
      IMPORTING
          node_key
          item_name
          sender.
    CLASS-METHODS: on_checkbox_change FOR EVENT checkbox_change OF cl_gui_column_tree
      IMPORTING
          node_key
          item_name
          checked
          sender.
    CLASS-METHODS: on_dft_context_menu_req FOR EVENT default_context_menu_request OF cl_gui_column_tree
      IMPORTING
          menu
          sender.
    CLASS-METHODS: on_dft_context_menu_sel FOR EVENT default_context_menu_select OF cl_gui_column_tree
      IMPORTING
          fcode
          sender.
    CLASS-METHODS: on_node_context_menu_req FOR EVENT node_context_menu_request OF cl_gui_column_tree
      IMPORTING
          node_key
          menu
          sender.
    CLASS-METHODS: on_node_context_menu_sel FOR EVENT node_context_menu_select OF cl_gui_column_tree
      IMPORTING
          node_key
          fcode
          sender.
    CLASS-METHODS: on_item_context_menu_req FOR EVENT item_context_menu_request OF cl_gui_column_tree
      IMPORTING
          node_key
          item_name
          menu
          sender.
    CLASS-METHODS: on_item_context_menu_sel FOR EVENT item_context_menu_select OF cl_gui_column_tree
      IMPORTING
          node_key
          item_name
          fcode
          sender.
    CLASS-METHODS: on_header_context_menu_req FOR EVENT header_context_menu_request OF cl_gui_column_tree
      IMPORTING
          header_name
          menu
          sender.
    CLASS-METHODS: on_header_context_menu_sel FOR EVENT header_context_menu_select OF cl_gui_column_tree
      IMPORTING
          header_name
          fcode
          sender.
ENDCLASS.

CLASS lcl_event IMPLEMENTATION.
* Doppelklick auf Icon
  METHOD on_node_double_click.
    MESSAGE node_key TYPE 'S'.
  ENDMETHOD.
* Doppelklick auf Item
  METHOD on_item_double_click.

    CASE item_name.
* wenn Item für Wert NETWR editiert werden soll
      WHEN co_netwr.
* Text aus der Nodes-Tabelle lesen
        ASSIGN it_items[ node_key = node_key item_name = item_name ] TO FIELD-SYMBOL(<i>).

        DATA: lv_changed TYPE as4flag.
        DATA: lv_value TYPE string.

        lv_value = condense( <i>-text ).

* Popup für Werte-Eingabe
        CALL FUNCTION 'CC_POPUP_STRING_INPUT'
          EXPORTING
            property_name = 'NETWR:'
          IMPORTING
            value_changed = lv_changed
          CHANGING
            string_value  = lv_value.

        IF lv_changed = abap_true.
* Text in der Item Table anpassen
          <i>-text = lv_value.

* Text in der Node anpassen
          sender->item_set_text( node_key  = node_key
                                 item_name = item_name
                                 text      = |{ <i>-text }| ).
        ENDIF.
    ENDCASE.

    MESSAGE |{ item_name }_{ node_key }| TYPE 'S'.
  ENDMETHOD.
* bei Expandierung eines Baumelements ohne Unterelemente
* hier können evtl. Daten nachgeladen werden
  METHOD on_expand_no_children.
    MESSAGE node_key TYPE 'S'.
  ENDMETHOD.
* Header-Klick
  METHOD on_header_click.
    MESSAGE |{ header_name }| TYPE 'S'.
  ENDMETHOD.
* Button-Klick
  METHOD on_button_click.
    MESSAGE |{ item_name }_{ node_key }| TYPE 'S'.
  ENDMETHOD.
* Link-Klick
  METHOD on_link_click.
    MESSAGE |{ item_name }_{ node_key }| TYPE 'S'.
  ENDMETHOD.
* Checkbox Change
  METHOD on_checkbox_change.
    MESSAGE |{ item_name }_{ node_key }: { checked }| TYPE 'S'.
  ENDMETHOD.
* Freier Klickbereich: Kontextmenu füllen
  METHOD on_dft_context_menu_req.

    menu->add_function( text = 'Message'
                        fcode = 'MSG' ).

    menu->add_function( text = 'Exit'
                        fcode = 'EXIT' ).

  ENDMETHOD.
* Freier Klickbereich: Klick im Kontextmenu auswerten
  METHOD on_dft_context_menu_sel.

    CASE fcode.

      WHEN 'MSG'.
        MESSAGE 'Message' TYPE 'S'.
      WHEN 'EXIT'.
        LEAVE PROGRAM.

    ENDCASE.

  ENDMETHOD.
* Node: Kontextmenu füllen
  METHOD on_node_context_menu_req.

    menu->add_function( text = |{ node_key }|
                        fcode = 'NODE' ).

  ENDMETHOD.
* Node: Klick im Kontextmenu auswerten
  METHOD on_node_context_menu_sel.

    CASE fcode.

      WHEN 'NODE'.
        MESSAGE node_key TYPE 'S'.

    ENDCASE.

  ENDMETHOD.
* Item: Kontextmenu füllen
  METHOD on_item_context_menu_req.

    menu->add_function( text = |{ node_key }_{ item_name }|
                        fcode = 'NODE_ITEM' ).

  ENDMETHOD.
* Item: Klick im Kontextmenu auswerten
  METHOD on_item_context_menu_sel.

    CASE fcode.

      WHEN 'NODE_ITEM'.
        MESSAGE |{ node_key }_{ item_name }| TYPE 'S'.

    ENDCASE.

  ENDMETHOD.
* Header: Kontextmenu füllen
  METHOD on_header_context_menu_req.

    menu->add_function( text = |{ header_name }|
                        fcode = 'HEADER' ).

  ENDMETHOD.
* Header: Klick im Kontextmenu auswerten
  METHOD on_header_context_menu_sel.

    CASE fcode.

      WHEN 'HEADER'.
        MESSAGE |{ header_name }| TYPE 'S'.

    ENDCASE.

  ENDMETHOD.
ENDCLASS.

START-OF-SELECTION.

  DATA: it_vbak_vbap TYPE ty_it_vbak_vbap.

* Daten holen -> bei zu vielen Elementen (-> 450?) kommt es zum Absturz der Trees
  SELECT vbak~auart, vbak~vbeln, vbap~posnr, vbap~matnr, vbap~arktx, vbap~netwr FROM vbak
    INNER JOIN vbap ON vbak~vbeln = vbap~vbeln
    INTO CORRESPONDING FIELDS OF TABLE @it_vbak_vbap
    UP TO 100 ROWS.

  SORT: it_vbak_vbap BY auart vbeln posnr.

* 1. Spalte des Trees
  DATA(lv_thhdr) = VALUE treev_hhdr( heading = co_auart
                                     width   = 50 ).

* Tree-Objekt im default_screen einbetten
  DATA(o_tree) = NEW cl_gui_column_tree( parent                = cl_gui_container=>default_screen
                                         node_selection_mode   = cl_gui_column_tree=>node_sel_mode_single
                                         item_selection        = abap_true
                                         hierarchy_column_name = co_auart
                                         hierarchy_header      = lv_thhdr ).

* Eventtypten müssen gesondert registriert werden
  DATA(it_events) = VALUE ty_it_events( ( eventid = cl_gui_column_tree=>eventid_node_double_click
                                          appl_event = abap_true )
                                        ( eventid = cl_gui_column_tree=>eventid_item_double_click
                                          appl_event = abap_true )
                                        ( eventid = cl_gui_column_tree=>eventid_expand_no_children
                                          appl_event = abap_true )
                                        ( eventid = cl_gui_column_tree=>eventid_link_click
                                          appl_event = abap_true )
                                        ( eventid = cl_gui_column_tree=>eventid_button_click
                                          appl_event = abap_true )
                                        ( eventid = cl_gui_column_tree=>eventid_checkbox_change
                                          appl_event = abap_true )
                                        ( eventid = cl_gui_column_tree=>eventid_header_click
                                          appl_event = abap_true )
                                        ( eventid = cl_gui_column_tree=>eventid_def_context_menu_req
                                          appl_event = abap_true )
                                        ( eventid = cl_gui_column_tree=>eventid_node_context_menu_req
                                          appl_event = abap_true )
                                        ( eventid = cl_gui_column_tree=>eventid_item_context_menu_req
                                          appl_event = abap_true )
                                        ( eventid = cl_gui_column_tree=>eventid_header_context_men_req
                                          appl_event = abap_true ) ).

* Events registrieren
  o_tree->set_registered_events( events = it_events ).

* Eventhandler für Klicks und Kontextmenüs
  SET HANDLER lcl_event=>on_node_double_click FOR o_tree.
  SET HANDLER lcl_event=>on_item_double_click FOR o_tree.
  SET HANDLER lcl_event=>on_expand_no_children FOR o_tree.
  SET HANDLER lcl_event=>on_header_click FOR o_tree.
  SET HANDLER lcl_event=>on_button_click FOR o_tree.
  SET HANDLER lcl_event=>on_link_click FOR o_tree.
  SET HANDLER lcl_event=>on_checkbox_change FOR o_tree.
  SET HANDLER lcl_event=>on_dft_context_menu_req FOR o_tree.
  SET HANDLER lcl_event=>on_dft_context_menu_sel FOR o_tree.
  SET HANDLER lcl_event=>on_node_context_menu_req FOR o_tree.
  SET HANDLER lcl_event=>on_node_context_menu_sel FOR o_tree.
  SET HANDLER lcl_event=>on_item_context_menu_req FOR o_tree.
  SET HANDLER lcl_event=>on_item_context_menu_sel FOR o_tree.
  SET HANDLER lcl_event=>on_header_context_menu_req FOR o_tree.
  SET HANDLER lcl_event=>on_header_context_menu_sel FOR o_tree.

* weitere Spalten entsprechend der Reihenfolge
  o_tree->add_column( name        = co_matnr
                      width       = 30
                      header_text = CONV #( co_matnr ) ).

  o_tree->add_column( name        = co_arktx
                      width       = 70
                      header_text = CONV #( co_arktx ) ).

  o_tree->add_column( name        = co_netwr
                      width       = 30
                      header_text = CONV #( co_netwr ) ).

  o_tree->add_column( name        = co_flag
                      width       = 5
                      header_text = CONV #( co_flag ) ).

* Inhalt des Trees komplett löschen
*  o_tree->delete_all_nodes( ).

* Rootnode einfügen
  it_nodes = VALUE #( ( node_key  = co_root
                        isfolder  = abap_true ) ).

* Items der Rootnode
  it_items = VALUE #( ( node_key  = co_root
                        item_name = co_auart
                        class     = cl_gui_column_tree=>item_class_text
                        text      = co_root
                        font      = cl_gui_column_tree=>item_font_fixed
                        style     = cl_gui_column_tree=>style_intensified )

                      ( node_key  = co_root
                        item_name = co_matnr
                        class     = cl_gui_column_tree=>item_class_text
                        text      = '' )

                      ( node_key  = co_root
                        item_name = co_arktx
                        class     = cl_gui_column_tree=>item_class_text
                        text      = '' )

                      ( node_key  = co_root
                        item_name = co_netwr
                        class     = cl_gui_column_tree=>item_class_text
                        text      = '' )

                      ( node_key  = co_root
                        item_name = co_flag
                        class     = cl_gui_column_tree=>item_class_text
                        text      = '' ) ).

* Unternodes: Auftragsarten <a> -> Belege <v> -> Positionen <p>
  LOOP AT it_vbak_vbap ASSIGNING FIELD-SYMBOL(<a>) GROUP BY <a>-auart ASCENDING.
* Node für Auftragsarten
    APPEND VALUE #( node_key  = <a>-auart
                    relatkey  = co_root
                    relatship = cl_gui_column_tree=>relat_last_child
                    isfolder  = abap_true
                    expander  = abap_true ) TO it_nodes.

* Items für Auftragsarten
    APPEND VALUE #( node_key  = <a>-auart
                    item_name = co_auart
                    class     = cl_gui_column_tree=>item_class_text
                    text      = <a>-auart
                    font      = cl_gui_column_tree=>item_font_fixed ) TO it_items.

    APPEND VALUE #( node_key  = <a>-auart
                    item_name = co_matnr
                    class     = cl_gui_column_tree=>item_class_text
                    text      = '' ) TO it_items.

    APPEND VALUE #( node_key  = <a>-auart
                    item_name = co_arktx
                    class     = cl_gui_column_tree=>item_class_text
                    text      = '' ) TO it_items.

    APPEND VALUE #( node_key  = <a>-auart
                    item_name = co_netwr
                    class     = cl_gui_column_tree=>item_class_text
                    text      = '' ) TO it_items.

    APPEND VALUE #( node_key  = <a>-auart
                    item_name = co_flag
                    class     = cl_gui_column_tree=>item_class_text
                    text      = '' ) TO it_items.

    LOOP AT GROUP <a> ASSIGNING FIELD-SYMBOL(<v>) GROUP BY <v>-vbeln ASCENDING.
* Node für Belegnummern
      APPEND VALUE #( node_key  = <v>-vbeln
                      relatkey  = <a>-auart
                      relatship = cl_gui_column_tree=>relat_last_child
                      isfolder  = abap_true
                      expander  = abap_true ) TO it_nodes.

* Items für Belegnummern
      APPEND VALUE #( node_key  = <v>-vbeln
                      item_name = co_auart
                      class     = cl_gui_column_tree=>item_class_text
                      text      = <v>-vbeln
                      font      = cl_gui_column_tree=>item_font_fixed ) TO it_items.

      APPEND VALUE #( node_key  = <v>-vbeln
                      item_name = co_matnr
                      class     = cl_gui_column_tree=>item_class_text
                      text      = '' ) TO it_items.

      APPEND VALUE #( node_key  = <v>-vbeln
                      item_name = co_arktx
                      class     = cl_gui_column_tree=>item_class_text
                      text      = '' ) TO it_items.

      APPEND VALUE #( node_key  = <v>-vbeln
                      item_name = co_flag
                      class     = cl_gui_column_tree=>item_class_text
                      text      = '' ) TO it_items.

      DATA(lv_sum_netwr) = VALUE vbap-netwr( ).
      DATA(lv_cnt) = 0.

      LOOP AT GROUP <v> ASSIGNING FIELD-SYMBOL(<p>).
* Node für Positionen
* eindeutigen Key erzeugen (max. 12 Zeichen lang)
        DATA(lv_pos_key) = |{ <p>-vbeln ALPHA = OUT }{ <p>-posnr ALPHA = OUT }|.
        APPEND VALUE #( node_key  = lv_pos_key
                        relatkey  = <v>-vbeln
                        relatship = cl_gui_column_tree=>relat_last_child
                        isfolder  = abap_false
                        expander  = abap_false ) TO it_nodes.

* Items für Positionen
        APPEND VALUE #( node_key  = lv_pos_key
                        item_name = co_auart
                        class     = cl_gui_column_tree=>item_class_button
                        text      = <p>-posnr
                        font      = cl_gui_column_tree=>item_font_default ) TO it_items.

        APPEND VALUE #( node_key  = lv_pos_key
                        item_name = co_matnr
                        class     = cl_gui_column_tree=>item_class_link
                        text      = <p>-matnr
                        style     = cl_gui_column_tree=>style_intensified
                        font      = cl_gui_column_tree=>item_font_fixed ) TO it_items.

        APPEND VALUE #( node_key  = lv_pos_key
                        item_name = co_arktx
                        class     = cl_gui_column_tree=>item_class_text
                        text      = <p>-arktx
                        font      = cl_gui_column_tree=>item_font_fixed ) TO it_items.

        APPEND VALUE #( node_key  = lv_pos_key
                        item_name = co_netwr
                        class     = cl_gui_column_tree=>item_class_text
                        text      = CONV string( <p>-netwr )
                        font      = cl_gui_column_tree=>item_font_fixed ) TO it_items.

        APPEND VALUE #( node_key  = lv_pos_key
                        item_name = co_flag
                        class     = cl_gui_column_tree=>item_class_checkbox
                        editable  = abap_true
                        text      = <p>-flag ) TO it_items.

* Summierung des NETWR für übergeordnetes Item
        lv_sum_netwr = lv_sum_netwr + <p>-netwr.
        lv_cnt = lv_cnt + 1.
      ENDLOOP.

* Ausgabe der Summe in Item für Position
      APPEND VALUE #( node_key  = <v>-vbeln
                      item_name = co_netwr
                      class     = cl_gui_column_tree=>item_class_text
                      text      = |Summe: { lv_sum_netwr } ({ lv_cnt })|
                      font      = cl_gui_column_tree=>item_font_fixed ) TO it_items.

    ENDLOOP.
  ENDLOOP.

* Nodes und Items zum Baum hinzufügen und anzeigen
  o_tree->add_nodes_and_items( node_table                = it_nodes
                               item_table                = it_items
                               item_table_structure_name = 'MTREEITM' ). &quot; Typ muss gleich mit Zeilentyp von it_items sein

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

* Spaltenbreiten anpassen
*  o_tree->adjust_column_width( all_columns     = abap_true
*                               include_heading = abap_true ).

* leere Toolbar ausblenden
  cl_abap_list_layout=>suppress_toolbar( ).

* Erzwingung der Listenausgabe in cl_gui_container=>default_screen und Anzeige des Trees
  WRITE space.

[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.
TYPES: ty_it_html TYPE STANDARD TABLE OF char1024 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.
DATA: it_salv_spfli TYPE STANDARD TABLE OF spfli.
DATA: it_sairport TYPE STANDARD TABLE OF sairport.

DATA: it_html TYPE ty_it_html.
**********************************************************************
*
* 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(<fs_carrid>).
          ASSIGN query_table[ name = co_airpto ] TO FIELD-SYMBOL(<fs_airpto>).

* iTab für SALV-Table neu aufbauen, abhängig von der Eingabe in den Formularfeldern
          it_salv_spfli = VALUE #( FOR l IN it_spfli WHERE ( ( carrid = <fs_carrid>-value ) OR ( airpto = <fs_airpto>-value ) )
                                   ( 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( ).
        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
  APPEND |<html>| TO it_html.
  APPEND |  <head>| TO it_html.
  APPEND |    <meta http-equiv="content-type" content="text/html; charset=utf-8">| TO it_html.
  APPEND |    <script type="text/javascript">| TO it_html.
  APPEND |      function onKeyDown(f)| TO it_html.
  APPEND |      \{ if(event.keyCode == 13)| TO it_html.
  APPEND |         \{ document[f.name].submit();| TO it_html.
  APPEND |         \}| TO it_html.
  APPEND |      \}| TO it_html.
  APPEND |    </script>| TO it_html.
  APPEND |    <style type="text/css">| TO it_html.
  APPEND |       body \{| TO it_html.
  APPEND |         font-family: Courier New;| TO it_html.
  APPEND |         font-size: 13px;| TO it_html.
  APPEND |         font-style: normal;| TO it_html.
  APPEND |         font-variant: normal;| TO it_html.
  APPEND |         font-weight: 400;| TO it_html.
  APPEND |         line-height: 13px;| TO it_html.
  APPEND |       \}| TO it_html.
  APPEND |       form \{| TO it_html.
  APPEND |         background: lightblue;| TO it_html.
  APPEND |       \}| TO it_html.
  APPEND |       label \{| TO it_html.
  APPEND |         text-align: right;| TO it_html.
  APPEND |         line-height: 1.5;| TO it_html.
  APPEND |         float: left;| TO it_html.
  APPEND |         width: 40%;| TO it_html.
  APPEND |       \}| TO it_html.
  APPEND |       input \{| TO it_html.
  APPEND |         margin: 0 0 1em .2em;| TO it_html.
  APPEND |         padding: .2em .5em;| TO it_html.
  APPEND |         background-color: #fffbf0;| TO it_html.
  APPEND |         border: 1px solid #e7c157;| TO it_html.
  APPEND |         float: left;| TO it_html.
  APPEND |         width: 40%;| TO it_html.
  APPEND |         font-family: Courier New;| TO it_html.
  APPEND |         font-size: 13px;| TO it_html.
  APPEND |         font-style: normal;| TO it_html.
  APPEND |         font-variant: normal;| TO it_html.
  APPEND |         font-weight: 400;| TO it_html.
  APPEND |         line-height: 13px;| TO it_html.
  APPEND |       \}| TO it_html.
  APPEND |       select \{| TO it_html.
  APPEND |         margin: 0 0 1em .2em;| TO it_html.
  APPEND |         padding: .2em .5em;| TO it_html.
  APPEND |         background-color: #fffbf0;| TO it_html.
  APPEND |         border: 1px solid #e7c157;| TO it_html.
  APPEND |         float: left;| TO it_html.
  APPEND |         width: 40%;| TO it_html.
  APPEND |         font-family: Courier New;| TO it_html.
  APPEND |         font-size: 13px;| TO it_html.
  APPEND |         font-style: normal;| TO it_html.
  APPEND |         font-variant: normal;| TO it_html.
  APPEND |         font-weight: 400;| TO it_html.
  APPEND |         line-height: 13px;| TO it_html.
  APPEND |       \}| TO it_html.
  APPEND |       button \{| TO it_html.
  APPEND |         margin-top: 1.5em;| TO it_html.
  APPEND |         float: right;| TO it_html.
  APPEND |       \}| TO it_html.
  APPEND |      </style>| TO it_html.
  APPEND |  </head>| TO it_html.
  APPEND |  <body>| TO it_html.
  APPEND |    <form name="INPUT" accept-charset="utf-8" method="post" action="SAPEVENT:INPUT_FIELDS">| TO it_html.
  APPEND |      <br>| TO it_html.
  APPEND |      <label for="{ co_carrid }">Fluggesellschaft:</label>| TO it_html.
  APPEND |      <input type="text" name="{ co_carrid }" value="LH" onKeyDown="onKeyDown(this.form);">| TO it_html.
  APPEND |      <br>| TO it_html.
  APPEND |      <label for="{ co_airpto }">Zielflughafen:</label>| TO it_html.
  APPEND |      <select name="{ co_airpto }">| TO it_html.

  LOOP AT it_sairport ASSIGNING FIELD-SYMBOL(<fs_airport>).
    APPEND |        <option>{ <fs_airport>-id }</option>| TO it_html.
  ENDLOOP.

  APPEND |      </select>| TO it_html.
  APPEND |      <br>| TO it_html.
  APPEND |      <button type="submit" title="Anzeigen">Anzeigen</button>| TO it_html.
  APPEND |      <br>| TO it_html.
  APPEND |      <br>| TO it_html.
  APPEND |      <br>| TO it_html.
  APPEND |      <br>| TO it_html.
  APPEND |    </form>| TO it_html.
  APPEND |  </body>| TO it_html.
  APPEND |</html>| TO it_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 char1024.

    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] HTML-basierte Anzeige: Ausklappbarer Dockingcontainer im Selektionsbild, Eventhandling

TYPES: ty_it_events TYPE STANDARD TABLE OF cntl_simple_event WITH DEFAULT KEY.
TYPES: ty_it_html TYPE STANDARD TABLE OF char1024 WITH DEFAULT KEY.

CONSTANTS c_dock_open TYPE i VALUE 400.
CONSTANTS c_dock_close TYPE i VALUE 150.
CONSTANTS c_cmd_open TYPE string VALUE 'OPEN'.
CONSTANTS c_cmd_close TYPE string VALUE 'CLOSE'.
CONSTANTS c_cmd_click TYPE string VALUE 'CLICK'.

DATA: o_docker TYPE REF TO cl_gui_docking_container.

PARAMETERS: p_field TYPE char10 DEFAULT '####'.

CLASS lcl_events DEFINITION.
  PUBLIC SECTION.

    CLASS-METHODS:
      on_sapevent FOR EVENT sapevent OF cl_gui_html_viewer
        IMPORTING
            action
            frame
            getdata
            postdata
            query_table.
ENDCLASS.

CLASS lcl_events IMPLEMENTATION.
  METHOD on_sapevent.

    IF o_docker IS BOUND.
      CASE action.
* Container ausklappen
        WHEN c_cmd_open.
          o_docker->set_extension( EXPORTING
                                     extension = c_dock_open ).
* Container einklappen
        WHEN c_cmd_close.
          o_docker->set_extension( EXPORTING
                                     extension = c_dock_close ).
      ENDCASE.
    ENDIF.

* Action im Parameterfeld ausgeben
    p_field = action.

  ENDMETHOD.

ENDCLASS.

INITIALIZATION.
* Docking-Container für HTML-Viewer-Element
  o_docker = NEW #( extension               = c_dock_close
                    side                    = cl_gui_docking_container=>dock_at_right
                    no_autodef_progid_dynnr = abap_true ).

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

* SAP-Events registrieren
  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 ).

  SET HANDLER lcl_events=>on_sapevent FOR o_html.

* HTML-Code
  DATA(it_html) = VALUE ty_it_html( ( |<html->| )
                                    ( |  <meta http-equiv="content-type" content="text/html" charset="ISO-8859-1"->| )
                                    ( |  <head->| )
                                    ( |  <title->Test</title->| )
                                    ( |  <script type="text/javascript"->| )
                                    ( |    function open_close(element)| )
                                    ( |    \{| )
                                    ( |      location.href = "SAPEVENT:" + element;| )
                                    ( |    \}| )
                                    ( |    function mouse_click(element)| )
                                    ( |    \{| )
                                    ( |      location.href = "SAPEVENT:" + element;| )
                                    ( |    \}| )
                                    ( |  </script->| )
                                    ( |  </head->| )
                                    ( |  <body style="overflow:auto"->| )
                                    ( |    <table border="0" width="300px"->| )
                                    ( |      <tr->| )
                                    ( |        <td-><button onmouseover="open_close('{ c_cmd_open }')"->Show</button-></td->| )
                                    ( |      </tr->| )
                                    ( |      <tr->| )
                                    ( |        <td->--------------------<a href="#" onclick="mouse_click('{ c_cmd_click }')"->Klick</a-></td->| )
                                    ( |      </tr->| )
                                    ( |      <tr->| )
                                    ( |        <td-><button onmouseover="open_close('{ c_cmd_close }')"->Hide</button-></td->| )
                                    ( |      </tr->| )
                                    ( |    </table->| )
                                    ( |  </body->| )
                                    ( |</html->| ) ).

* HTML anzeigen
  DATA: lv_url TYPE char1024.

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

  o_html->show_url( url = lv_url ).

Weiterführende Infos: Link

[ABAP] Baumstruktur mit Hilfe des cl_gui_list_tree anzeigen, Events abfangen

TYPES: ty_it_events TYPE STANDARD TABLE OF cntl_simple_event WITH DEFAULT KEY.

DATA: it_nodes TYPE treev_ntab.
DATA: it_items TYPE STANDARD TABLE OF mtreeitm WITH DEFAULT KEY.

CLASS lcl_event DEFINITION.
  PUBLIC SECTION.
    CLASS-METHODS: on_node_double_click FOR EVENT node_double_click OF cl_gui_list_tree
      IMPORTING
          node_key.
    CLASS-METHODS: on_expand_no_children FOR EVENT expand_no_children OF cl_gui_list_tree
      IMPORTING
          node_key.
    CLASS-METHODS: on_item_double_click FOR EVENT item_double_click OF cl_gui_list_tree
      IMPORTING
          node_key
          item_name.
    CLASS-METHODS: on_button_click FOR EVENT button_click OF cl_gui_list_tree
      IMPORTING
          node_key
          item_name.
    CLASS-METHODS: on_link_click FOR EVENT link_click OF cl_gui_list_tree
      IMPORTING
          node_key
          item_name.
    CLASS-METHODS: on_checkbox_change FOR EVENT checkbox_change OF cl_gui_list_tree
      IMPORTING
          node_key
          item_name
          checked.
ENDCLASS.

CLASS lcl_event IMPLEMENTATION.
  METHOD on_node_double_click.
    WRITE: / |Node double click on node: { node_key }|.
  ENDMETHOD.

  METHOD on_item_double_click.
    WRITE: / |Item double click on node: { node_key }, item: { item_name }|.
  ENDMETHOD.

  METHOD on_link_click.
    WRITE: / |Link click on node: { node_key }, item: { item_name }|.
  ENDMETHOD.

  METHOD on_button_click.
    WRITE: / |Button click on node: { node_key }, item: { item_name }|.
  ENDMETHOD.

  METHOD on_checkbox_change.
    WRITE: / |Checkbox change on node: { node_key }, item: { item_name }|.
  ENDMETHOD.

  METHOD on_expand_no_children.
    WRITE: / |Expand no children on node: { node_key }|.
  ENDMETHOD.
ENDCLASS.

START-OF-SELECTION.

* Container-Objekt erzeugen
  DATA(o_dock) = NEW cl_gui_docking_container( no_autodef_progid_dynnr = abap_true
                                               side = cl_gui_docking_container=>dock_at_left
                                               ratio = 20
                                               caption = 'Datenausgabe' ).

* Tree-Objekt erzeugen
  DATA(o_tree) = NEW cl_gui_list_tree( parent = o_dock
                                       node_selection_mode = cl_gui_list_tree=>node_sel_mode_single
                                       item_selection = abap_true
                                       with_headers = abap_false ).

* Eventtypten müssen gesondert registriert werden
  DATA(it_events) = VALUE ty_it_events( ( eventid    = cl_gui_list_tree=>eventid_node_double_click
                                          appl_event = abap_true )
                                        ( eventid    = cl_gui_list_tree=>eventid_item_double_click
                                          appl_event = abap_true )
                                        ( eventid    = cl_gui_list_tree=>eventid_expand_no_children
                                          appl_event = abap_true )
                                        ( eventid    = cl_gui_list_tree=>eventid_link_click
                                          appl_event = abap_true )
                                        ( eventid    = cl_gui_list_tree=>eventid_button_click
                                          appl_event = abap_true )
                                        ( eventid    = cl_gui_list_tree=>eventid_checkbox_change
                                          appl_event = abap_true ) ).

  o_tree->set_registered_events( events = it_events ).

  SET HANDLER lcl_event=>on_node_double_click FOR o_tree.
  SET HANDLER lcl_event=>on_item_double_click FOR o_tree.
  SET HANDLER lcl_event=>on_expand_no_children FOR o_tree.
  SET HANDLER lcl_event=>on_link_click FOR o_tree.
  SET HANDLER lcl_event=>on_button_click FOR o_tree.
  SET HANDLER lcl_event=>on_checkbox_change FOR o_tree.

* Tree-Nodes einfügen -> die Bezeichner müssen eindeutig sein
  it_nodes = VALUE #( ( node_key  = 'ROOT'
                        hidden    = abap_false
                        disabled  = abap_false
                        isfolder  = abap_true )

                      ( node_key  = 'NODE1'
                        relatkey  = 'ROOT'
                        relatship = cl_gui_list_tree=>relat_last_child
                        hidden    = abap_false
                        disabled  = abap_false
                        isfolder  = abap_true )

                      ( node_key  = 'NODE1_1'
                        relatkey  = 'NODE1'
                        relatship = cl_gui_list_tree=>relat_last_child
                        hidden    = abap_false
                        disabled  = abap_false
                        isfolder  = abap_false )

                      ( node_key  = 'NODE1_2'
                        relatkey  = 'NODE1'
                        relatship = cl_gui_list_tree=>relat_last_child
                        hidden    = abap_false
                        disabled  = abap_false
                        isfolder  = abap_false )

                      ( node_key  = 'NODE1_3'
                        relatkey  = 'NODE1'
                        relatship = cl_gui_list_tree=>relat_last_child
                        hidden    = abap_false
                        disabled  = abap_false
                        isfolder  = abap_false )

                      ( node_key  = 'NODE2'
                        relatkey  = 'ROOT'
                        relatship = cl_gui_list_tree=>relat_last_child
                        hidden    = abap_false
                        disabled  = abap_false
                        isfolder  = abap_false )

                      ( node_key  = 'NODE3'
                        relatkey  = 'ROOT'
                        relatship = cl_gui_list_tree=>relat_last_child
                        hidden    = abap_false
                        disabled  = abap_false
                        isfolder  = abap_false ) ).

* Items für die Nodes definieren
  it_items = VALUE #( ( node_key  = 'ROOT'
                        item_name = '1'
                        style     = cl_gui_list_tree=>style_default
                        class     = cl_gui_list_tree=>item_class_text
                        alignment = cl_gui_list_tree=>align_auto
                        font      = cl_gui_list_tree=>item_font_fixed
                        text      = 'Root'
                        t_image   = icon_led_green )
* Ordner
                      ( node_key  = 'NODE1'
                        item_name = '1'
                        style     = cl_gui_list_tree=>style_default
                        class     = cl_gui_list_tree=>item_class_text
                        alignment = cl_gui_list_tree=>align_auto
                        font      = cl_gui_list_tree=>item_font_fixed
                        text      = 'Node 1'
                        t_image   = icon_led_yellow )
* Item Button
                      ( node_key  = 'NODE1_1'
                        item_name = '1'
                        style     = cl_gui_list_tree=>style_default
                        class     = cl_gui_list_tree=>item_class_button
                        alignment = cl_gui_list_tree=>align_auto
                        font      = cl_gui_list_tree=>item_font_fixed
                        text      = 'Node 1_1'
                        t_image   = icon_led_green )
* Item Checkbox
                      ( node_key  = 'NODE1_2'
                        item_name = '1'
                        style     = cl_gui_list_tree=>style_default
                        class     = cl_gui_list_tree=>item_class_checkbox
                        alignment = cl_gui_list_tree=>align_auto
                        font      = cl_gui_list_tree=>item_font_fixed
                        text      = 'Node 1_2'
                        t_image   = icon_led_green
                        editable  = abap_true )
* Item Link
                      ( node_key  = 'NODE1_3'
                        item_name = '1'
                        style     = cl_gui_list_tree=>style_default
                        class     = cl_gui_list_tree=>item_class_link
                        alignment = cl_gui_list_tree=>align_auto
                        font      = cl_gui_list_tree=>item_font_fixed
                        text      = 'Node 1_3'
                        t_image   = icon_led_green )
* Item mit 4 Spalten
                      ( node_key   = 'NODE2'
                        item_name  = '1'
                        style      = cl_gui_list_tree=>style_default
                        class      = cl_gui_list_tree=>item_class_text
                        alignment  = cl_gui_list_tree=>align_auto
                        font       = cl_gui_list_tree=>item_font_fixed
                        text       = ''
                        t_image    = icon_led_green
                        usebgcolor = abap_true )

                      ( node_key   = 'NODE2'
                        item_name  = '2'
                        style      = cl_gui_list_tree=>style_default
                        class      = cl_gui_list_tree=>item_class_text
                        alignment  = cl_gui_list_tree=>align_left
                        font       = cl_gui_list_tree=>item_font_fixed
                        length     = 4
                        text       = '1000'
                        usebgcolor = abap_true )

                      ( node_key   = 'NODE2'
                        item_name  = '3'
                        style      = cl_gui_list_tree=>style_default
                        class      = cl_gui_list_tree=>item_class_text
                        alignment  = cl_gui_list_tree=>align_left
                        font       = cl_gui_list_tree=>item_font_fixed
                        length     = 10
                        text       = 'Liter'
                        usebgcolor = abap_true )

                      ( node_key   = 'NODE2'
                        item_name  = '4'
                        style      = cl_gui_list_tree=>style_default
                        class      = cl_gui_list_tree=>item_class_text
                        alignment  = cl_gui_list_tree=>align_auto
                        font       = cl_gui_list_tree=>item_font_prop
                        text       = 'Testeintrag 1' )
* Item mit 4 Spalten
                      ( node_key   = 'NODE3'
                        item_name  = '1'
                        style      = cl_gui_list_tree=>style_default
                        class      = cl_gui_list_tree=>item_class_text
                        alignment  = cl_gui_list_tree=>align_auto
                        font       = cl_gui_list_tree=>item_font_fixed
                        text       = ''
                        t_image    = icon_led_green
                        usebgcolor = abap_true )

                      ( node_key   = 'NODE3'
                        item_name  = '2'
                        style      = cl_gui_list_tree=>style_default
                        class      = cl_gui_list_tree=>item_class_text
                        alignment  = cl_gui_list_tree=>align_left
                        font       = cl_gui_list_tree=>item_font_fixed
                        length     = 4
                        text       = '0100'
                        usebgcolor = abap_true )

                      ( node_key   = 'NODE3'
                        item_name  = '3'
                        style      = cl_gui_list_tree=>style_default
                        class      = cl_gui_list_tree=>item_class_text
                        alignment  = cl_gui_list_tree=>align_left
                        font       = cl_gui_list_tree=>item_font_fixed
                        length     = 10
                        text       = 'mm'
                        usebgcolor = abap_true )

                      ( node_key   = 'NODE3'
                        item_name  = '4'
                        style      = cl_gui_list_tree=>style_default
                        class      = cl_gui_list_tree=>item_class_text
                        alignment  = cl_gui_list_tree=>align_auto
                        font       = cl_gui_list_tree=>item_font_prop
                        text       = 'Testeintrag 2' ) ).

  o_tree->add_nodes_and_items( node_table                = it_nodes
                               item_table                = it_items
                               item_table_structure_name = 'MTREEITM' ). " Typ muss gleich mit Zeilentyp von it_items sein

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

* leere Toolbar ausblenden
  cl_abap_list_layout=>suppress_toolbar( ).

  WRITE space. " wichtig für Erzwingung der Listenausgabe und Anzeige des Trees

Weiterführende Infos: Link und Link

[ABAP] Eigene GUI-Toolbar in einem Split-Container anzeigen, Eventhandling

TYPES: ty_it_events TYPE STANDARD TABLE OF cntl_simple_event WITH DEFAULT KEY.

CLASS lcl_events DEFINITION.
  PUBLIC SECTION.
    CLASS-METHODS:
      on_function_selected FOR EVENT function_selected OF cl_gui_toolbar
        IMPORTING
            fcode
            sender.
ENDCLASS.

CLASS lcl_events IMPLEMENTATION.
* Toolbar Button geklickt
  METHOD on_function_selected.

    CASE fcode.
      WHEN 'BTN_CLOSE'.
        LEAVE PROGRAM.
      WHEN 'BTN_TEST'.
        MESSAGE 'TEST' TYPE 'I' DISPLAY LIKE 'S'.
    ENDCASE.

  ENDMETHOD.

ENDCLASS.

INITIALIZATION.

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

* Absoluter Modus für Zeilenhöhe
  o_splitter->set_row_mode( mode = cl_gui_splitter_container=>mode_absolute ).

* Höhe absolut 24 Pixel für Splitter oben
  o_splitter->set_row_height( id = 1 height = 24 ).

* Splitter für oberen Container fest und verborgen
  o_splitter->set_row_sash( id = 1
                            type = cl_gui_splitter_container=>type_movable
                            value = cl_gui_splitter_container=>false ).

  o_splitter->set_row_sash( id = 1
                            type = cl_gui_splitter_container=>type_sashvisible
                            value = cl_gui_splitter_container=>false ).

  DATA(o_container_top) = o_splitter->get_container( row = 1 column = 1 ).
  DATA(o_container_bottom) = o_splitter->get_container( row = 2 column = 1 ).

* Toolbar hoizontal
  DATA(o_tool) = NEW cl_gui_toolbar( parent = o_container_top
                                     display_mode = cl_gui_toolbar=>m_mode_horizontal ).

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

  o_tool->set_registered_events( events = it_events ).

* Toolbar-Buttons hinzufügen
* Buttontypen sind in Typgruppe CNTB definiert
  o_tool->add_button( fcode       = 'BTN_TEST'
                      icon        = icon_activate
                      butn_type   = cntb_btype_button
                      text        = 'Test'
                      quickinfo   = 'Test'
                      is_checked  = abap_false
                      is_disabled = abap_false ).

  o_tool->add_button( fcode       = ''
                      icon        = ''
                      butn_type   = cntb_btype_sep
                      text        = ''
                      quickinfo   = ''
                      is_checked  = abap_false
                      is_disabled = abap_false ).

  o_tool->add_button( fcode       = 'BTN_CLOSE'
                      icon        = icon_close
                      butn_type   = cntb_btype_button
                      text        = 'Schließen'
                      quickinfo   = 'Schließen'
                      is_checked  = abap_false
                      is_disabled = abap_false ).

* Eventhandler registrieren
  SET HANDLER lcl_events=>on_function_selected FOR o_tool.

* im unteren 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_bottom
                          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.

[ABAP] HTML-Code im cl_gui_html_viewer anzeigen, Eventhandling

* Demoprogramme:
* SAPHTML_EVENTS_DEMO
* SAPHTML_SCRIPT_DEMO
* DEMO_TABLE_EXPRESSIONS

TYPES: ty_it_events TYPE STANDARD TABLE OF cntl_simple_event WITH DEFAULT KEY.
TYPES: ty_it_html TYPE STANDARD TABLE OF char1024 WITH DEFAULT KEY.

PARAMETERS: p_url TYPE string.

CLASS lcl_events DEFINITION.
  PUBLIC SECTION.

    CLASS-METHODS:
      on_navigate_complete FOR EVENT navigate_complete OF cl_gui_html_viewer
        IMPORTING
            url
            sender.

    CLASS-METHODS:
      on_sapevent FOR EVENT sapevent OF cl_gui_html_viewer
        IMPORTING
            action
            frame
            getdata
            postdata
            query_table
            sender.
ENDCLASS.

CLASS lcl_events IMPLEMENTATION.

* nach Aufbau des Dokuments
  METHOD on_navigate_complete.
    p_url = url.
  ENDMETHOD.

* Link- oder Button-Klick
  METHOD on_sapevent.
    MESSAGE |Action: { action }, get: { getdata }| TYPE 'S'.
  ENDMETHOD.
ENDCLASS.

INITIALIZATION.

  DATA(o_dock) = NEW cl_gui_docking_container( ratio = 50
                                               side = cl_gui_docking_container=>dock_at_bottom
                                               no_autodef_progid_dynnr = 'X' ).

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

* Eventtypten müssen gesondert registriert werden
  DATA(it_events) = VALUE ty_it_events( ( eventid = cl_gui_html_viewer=>m_id_navigate_complete
                                          appl_event = abap_true )
                                        ( 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_events=>on_navigate_complete FOR o_html.
  SET HANDLER lcl_events=>on_sapevent FOR o_html.

* HTML-Code mit Buttons und Forms
  DATA(it_html) = VALUE ty_it_html( ( |<html>| )
                                    ( |  <head>| )
                                    ( |    <title>Drag & Drop Test</title>| )
                                    ( |  </head>| )
                                    ( |  <script type="text/javascript">| )
                                    ( |    function mouse_click(element)| )
                                    ( |    \{| )
                                    ( |      location.href = "SAPEVENT:" + element;| )
                                    ( |    \}| )
                                    ( |  </script>| )
                                    ( |  <body bgcolor="#AABBCC">| )
                                    ( |    <p><font size=30>Dateien mit der Maus hierher ziehen!</font></p>| )
                                    ( |    <form method="post" action="SAPEVENT:SHOW_INFO?PARAMETER1">| )
                                    ( |      <p><input type="submit" value="Klick!"></p>| )
                                    ( |    </form>| )
                                    ( |    <form method="post" action="">| )
                                    ( |      <a href="SAPEVENT:LINK_KLICK?PARAMETER2">Link</a>| )
                                    ( |    </form>| )
                                    ( |    <button onclick="mouse_click('BTN_CLICK')">Show</button>| )
                                    ( |  </body>| )
                                    ( |</html>| ) ).

* URL zu HTML holen
  DATA: lv_url TYPE char1024.

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

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