[ABAP] Verwendung von Tabellen in cl_dd_document (Dynamische Dokumente)

TRY.
* DD-Dokumentobjekt anlegen und Hintergrundfarbe festlegen
    DATA(o_doc) = NEW cl_dd_document( background_color = cl_dd_area=>col_textarea ).

* max. 255 Zeichen
    o_doc->add_text( text          = 'Fluginformationen'
                     sap_style     = cl_dd_document=>heading ).

* Trennlinie
    o_doc->underline( ).

* Text
    o_doc->add_text( text          = 'Tabelle:'
                     sap_emphasis  = cl_dd_document=>strong
                     sap_fontstyle = cl_dd_area=>serif ).

* Leerzeile
    o_doc->new_line( ).

    DATA: o_table TYPE REF TO cl_dd_table_element.
    DATA: o_table_area TYPE REF TO cl_dd_table_area.

* Tabelle mit 2 Spalten anlegen
    o_doc->add_table( EXPORTING
                        no_of_columns               = 2
                        cell_background_transparent = abap_false
                      IMPORTING
                        table                       = o_table
                        tablearea                   = o_table_area ).

* Spalte 1, Stil hellblau
    o_table->set_column_style( col_no    = 1
                               sap_style = cl_dd_area=>key ).

* Tabelle hat 2 Spalten, daher 2 Texte hinzufügen
    o_table_area->add_text( text = 'Fluggesellschaft' sap_emphasis = cl_dd_area=>strong ).
    o_table_area->add_text( text = 'LH' ).

* Zeile voll - weiter zur nächsten Zeile
    o_table_area->new_row( ).

    o_table_area->add_text( text = 'Flugnummer' sap_emphasis = cl_dd_area=>strong ).
    o_table_area->add_text( text = '400' ).

* Zweite Zeile voll
    o_table_area->new_row( ).

* Zeile 3
    o_table_area->add_text( text = 'Von' sap_emphasis = cl_dd_area=>strong ).
    o_table_area->add_text( text = 'Frankfurt' ).

* Dritte Zeile voll
    o_table_area->new_row( ).

* Zeile 4
    o_table_area->add_text( text = 'Nach' sap_emphasis = cl_dd_area=>strong ).
    o_table_area->add_text( text = 'New York' ).

* Vierte Zeile voll
    o_table_area->new_row( ).

* Dokumentelemente zusammenführen
    o_doc->merge_document( ).
* Dokument im Standardcontainer anzeigen
    o_doc->display_document( parent = cl_gui_container=>default_screen ).

* erzwingen von cl_gui_container=>default_screen
    WRITE space.

  CATCH cx_root INTO DATA(e_txt).
    WRITE: / e_txt->get_text( ).
ENDTRY.