[ABAP] Datenelement und zugehörige Domäne auslesen

* Name Datenelement
PARAMETERS: p_elem TYPE rollname DEFAULT 'TXT50'.
* Sprachenschlüssel
PARAMETERS: p_lang TYPE ddlanguage DEFAULT 'D'.

SELECT * INTO TABLE @DATA(it_dd04l) FROM dd04l
  WHERE rollname  = @p_elem.

IF sy-subrc = 0.
* Bezeichner zum Datenelent holen
  SELECT * INTO TABLE @DATA(it_dd04t) FROM dd04t
    WHERE rollname   = @p_elem
      AND ddlanguage = @p_lang.

* aktive Domäne holen
  DATA(lv_domname) = it_dd04l[ as4local = 'A' ]-domname.
  SELECT * INTO TABLE @DATA(it_dd01l) FROM dd01l
    WHERE domname = @lv_domname.

* Bezeichner zur Domäne holen
  SELECT * INTO TABLE @DATA(it_dd01t) FROM dd01t
    WHERE domname    = @lv_domname
      AND ddlanguage = @p_lang.

  IF sy-subrc = 0.
    cl_demo_output=>write_data( value = it_dd04l name = |Datenelement: { p_elem }| ).
    cl_demo_output=>write_data( value = it_dd04t name = |Datenelement: { p_elem }| ).
    cl_demo_output=>write_data( value = it_dd01l name = |Domäne: { lv_domname }| ).
    cl_demo_output=>write_data( value = it_dd01t name = |Domäne: { lv_domname }| ).
    cl_demo_output=>display(  ).
  ENDIF.
ENDIF.

Links