SAP Help Get fixed domain values in SAP values









Retrieve fixed SAP domain values

The following abap code shows you how to retrieve the fixed values from a SAP domain. These are the values actually entered into the domain when creating it rather than having a value table assigned to it.



data: it_dd07t type STANDARD TABLE OF dd07t,
      wa_dd07t like line of it_dd07t.
      

"Retrieve SAP domain values directly from sap table
  
  SELECT *   "ddtext = text value, domvalue_l = code value
    FROM dd07t
    INTO table it_dd07t
   WHERE domname    EQ 'ZDOMAIN' AND  "replace with name of your domain
         ddlanguage EQ sy-langu.
         
         
 "or get SAP domain values using FM DD_DOMVALUES_GET

  CALL FUNCTION 'DD_DOMVALUES_GET'
    EXPORTING
      domname        = 'EBELN'
      text           = 'X'
      langu          = sy-langu
    TABLES
      dd07v_tab      = it_dd07v
    EXCEPTIONS
      wrong_textflag = 1
      OTHERS         = 2.

  LOOP AT it_dd07v INTO wa_dd07v.
    write:/ wa_dd07v-domvalue_l, wa_dd07v-ddtext.
  ENDLOOP.