[ABAP] Informationen zu Business Objekten anzeigen

PARAMETERS: p_objtyp TYPE swo_objtyp DEFAULT 'BUS2012'.

START-OF-SELECTION.

  SELECT dv~objtype,   " BO Typ
         dv~verb,      " Funktion
         dv~verbtype,  " Funktionstyp ( ' ' =	Kein Verb, K = Schlüsselfeld, A = Attribut, M = Methode, E = Ereignis )
         dv~editelem,  " Element
         dv~refstruct, " Tabelle
         dv~reffield,  " Bezugsfeld
         dv~abapname,  " Funktionsbaustein
         tv~descript,  " Beschreibung
         tv~shorttext  " Kurztext
    INTO TABLE @DATA(it_bor_info)
    FROM swotdv AS dv
    INNER JOIN swottv AS tv ON dv~objtype = tv~objtype AND dv~verb = tv~verb
    WHERE dv~objtype = @p_objtyp
      AND tv~language = @sy-langu.

  IF sy-subrc = 0.

    SORT: it_bor_info BY verbtype verb.

    TRY.
* SALV-Table
        DATA: o_salv TYPE REF TO cl_salv_table.

        cl_salv_table=>factory( IMPORTING
                                  r_salv_table   = o_salv
                                CHANGING
                                  t_table        = it_bor_info ).

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

* Spaltenüberschriften: technischer Name und Beschreibungstexte
        LOOP AT o_salv->get_columns( )->get( ) ASSIGNING FIELD-SYMBOL(<c>).
          DATA(o_col) = <c>-r_column.
          o_col->set_short_text( || ).
          o_col->set_medium_text( || ).
          o_col->set_long_text( |{ o_col->get_columnname( ) } [{ o_col->get_long_text( ) }]| ).
        ENDLOOP.

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