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.

Related Articles

Create SAP database table within the data dictionary transaction SE11
SAP Dictionary objects - Example code and information of the SAP dictionary
Download SAP database structure to file
SAP Database locking using ENQUEUE and DEQUEUE
Modify your SAP database table maintenance events, screen, interface and code
Create and maintain parameter values in TVARVC using STVAR SAP transaction
Create SAP database table maintenance for your custom Z table using transaction SE11
SAP database table settings for Master, Application, Transaction and Customizing data
SAP text table create
Creating transaction code for table maintenance (SM30)
Retrieve text for table field