[ABAP] Infos zu Datenelementen und Domänen lesen

* Name Datenelement
PARAMETERS: p_dtype TYPE ddobjname DEFAULT 'CCCATEGORY'.

START-OF-SELECTION.

  DATA: lv_gotstate	TYPE ddgotstate.
  DATA: lv_dd04v_wa	TYPE dd04v.
  DATA: lv_tpara_wa	TYPE tpara.

* DD: Schnittstelle zum Lesen eines Datenelements aus dem ABAP/4 Dictionary
  CALL FUNCTION 'DDIF_DTEL_GET'
    EXPORTING
      name          = p_dtype
    IMPORTING
      gotstate      = lv_gotstate
      dd04v_wa      = lv_dd04v_wa
      tpara_wa      = lv_tpara_wa
    EXCEPTIONS
      illegal_input = 1
      OTHERS        = 2.

  IF sy-subrc = 0.
    DATA: lv_gotstate_d	TYPE ddgotstate.
    DATA: lv_dd01v_wa	TYPE dd01v.
    DATA: it_dd07v_tab TYPE STANDARD TABLE OF dd07v WITH DEFAULT KEY.

* DD: Schnittstelle zum Lesen einer Domäne aus dem ABAP/4 Dictionary
    CALL FUNCTION 'DDIF_DOMA_GET'
      EXPORTING
        name          = lv_dd04v_wa-domname
      IMPORTING
        gotstate      = lv_gotstate_d
        dd01v_wa      = lv_dd01v_wa
      TABLES
        dd07v_tab     = it_dd07v_tab
      EXCEPTIONS
        illegal_input = 1
        OTHERS        = 2.

    IF sy-subrc = 0.
      cl_demo_output=>next_section( |Datentyp { p_dtype }| ).
      cl_demo_output=>write_data( lv_gotstate ).
      cl_demo_output=>write_data( lv_dd04v_wa ).
      cl_demo_output=>write_data( lv_tpara_wa ).

      cl_demo_output=>next_section( |Domäne { lv_dd04v_wa-domname }| ).
      cl_demo_output=>write_data( lv_gotstate_d ).
      cl_demo_output=>write_data( lv_dd01v_wa ).
      cl_demo_output=>write_data( it_dd07v_tab ).

* HTML-Code vom Demo-Output holen
      DATA(lv_html) = cl_demo_output=>get( ).

* Daten im Inline-Browser im SAP-Fenster anzeigen
      cl_abap_browser=>show_html( EXPORTING
                                    title        = 'Infos'
                                    html_string  = lv_html
                                    container    = cl_gui_container=>default_screen ).

* cl_gui_container=>default_screen erzwingen
      WRITE: space.
    ENDIF.
  ENDIF.

Links