[ABAP] Dynamische Dokumente mit SALV-Form LayoutGrid / ABAP-Renderer erstellen

START-OF-SELECTION.

* Grid
  DATA(o_grid) = NEW cl_salv_form_layout_grid( ).

* Gridlines
  o_grid->set_grid_lines( if_salv_form_c_grid_lines=>lines ).

* Header (Überschrift), Colspan
  DATA(o_head) = o_grid->create_header_information( row = 1
                                                    column = 1
                                                    text = 'Überschrift'
                                                    colspan = 2 ).

* Header Align Center
  DATA: o_al_head TYPE REF TO cl_salv_form_layout_data_grid.
  o_al_head ?= o_head->get_layout_data( ).
  o_al_head->set_h_align( if_salv_form_c_h_align=>center ).

* Text
  DATA(o_text) = o_grid->create_text( row = 2
                                      column  = 2
                                      text    = 'Right'
                                      tooltip = 'Right' ).

* Text Align Right
  DATA: o_al_text TYPE REF TO cl_salv_form_layout_data_grid.
  o_al_text ?= o_text->get_layout_data( ).
  o_al_text->set_h_align( if_salv_form_c_h_align=>right ).

* GroupBox
  DATA(o_grp1) = NEW cl_salv_form_groupbox( header = 'My Groupbox 1' ).
  o_grid->set_element( row = 3
                       column = 1
                       r_element = o_grp1 ).

  DATA(o_grp_grid) = o_grp1->create_grid( ).
  o_grp_grid->set_grid_lines( if_salv_form_c_grid_lines=>lines ).
  o_grp_grid->create_text( row = 1
                           column = 1
                           text = 'Icon' ).

* Icon
  DATA(o_icon) = NEW cl_salv_form_icon( icon = icon_header
                                        tooltip = 'Tooltip for Icon' ).

  o_grp_grid->set_element( row       = 1
                           column    = 2
                           r_element = o_icon ).

* Label, Text
  DATA(o_label) = o_grid->create_label( row = 4
                                        column = 1
                                        text = 'Name:' ).
  o_text = o_grid->create_text( row = 4
                                column = 2
                                text = 'Herr Mayer' ).
  o_label->set_label_for( o_text ).

* Row
  DATA(o_row) = o_grid->add_row( ).
  o_label = o_row->create_label( text = 'Firma:' ).
  o_text = o_row->create_text( text = 'Beier' ).
  o_label->set_label_for( o_text ).

* HTML-Renderer
  DATA(o_form) = NEW cl_salv_form_window_dydos( popup = abap_true     " als modales Fenster anzeigen, nicht verfügbar bei cl_salv_form_window_abap
                                                r_content = o_grid ).

* Status
  DATA(o_status) = o_form->get_status( ).
  o_status->set_titlebar( titlebar       = 'FORM1_TITLE'              " GUI-Titel der Anwendung muss gepflegt sein
                          titlebar_repid = sy-repid ).

* Display
  o_form->display( ).