SAP ABAP Domain

What are the domains in ABAP DICTIONARY?

A domain is one of the fundamental objects of the ABAP data dictionary, which is used to define the technical attribute of the fields such as data type, length, and value range of values accepted by a field. It is assigned to a data element and can be reused in the field.

Domains are the smallest unit in ABAP that define data in the ABAP dictionary. All these domains are stored in DDO1L (Standard ABAP Table), and their descriptions are stored in the DDO1T table.

The fields of a table and the structures that use a domain are automatically assigned with the values ranges that are defined in that domain.

The domain and field relationship can be explained using the data element of the field. If we make a change in any of the domain, then the attributes of the field that are related to the particular domain, also get changed. A single domain can be used by multiple numbers of data elements of the field. Consider the below diagram:

SAP ABAP Domain

As we can see in the above diagram, the Data Element1 of Table 1 and Table 2, and Data Element2 of Table 3 are using the same domain.

We can perform below tasks in the SAP system with the help of domain:

  • Describe the fixed values for domains
  • Conversion routine for domains
  • Domains Creation
  • Modification in Existing domain
  • Deletion of a domain

Describing Fixed values for Domains

We can assign some fixed values for data types and length, to a domain. These fixed values are helpful in providing some input checks for the fields on a screen.

The fixed values can also be used as the source of the input help (F4) for the fields. These values can be created by defining either single values or the lower and upper limits of the fields.

Conversion Routines for the Domains

The data that we enter in the SAP system is not stored in the original format in the SAP database, and it needs to be converted into the format compatible with the SAP database. For example, the login time of the FTIME screen stores the data in the HHH: MM format. So, when a user enters a time, let's say 2:45; this value is stored in the SAP databases into integer value such as 165 minutes. However, when we retrieve the data from the system, it displays the data into the original format only. Such tasks of conversion from one format to another are performed by the conversion routines assigned to the domain at the time of domain creation.

Creating Domains in ABAP

Below are the steps for creating ABAP domain in the ABAP dictionary:

  • Step-1: Follow the menu path for the ABAP dictionary or enter the SE11 transaction code in the command field. It will open the initial screen of the ABAP Dictionary. Consider the below image:
    SAP ABAP Domain
  • Step-2: From the given option, click on the radio button in front of the Domain and enter the name of the domain. The name must start with the letter z as per the naming conventions. Consider the below image:
    SAP ABAP Domain
  • Step-3: Once we click on the create button, it opens a new window, where we need to fill all the fields that we want to use for further.
    SAP ABAP Domain

In the given DICTIONARY MAINTAIN SCREEN, we have entered the Short description, which is the general description of the domain.

  • Step-4: Now, we need to fill Format details that we want to define for the data elements such as Data Type, number of characters, decimal places, etc., and Output Characteristics such as Output Length and Routine. Here Output length is the length of characters that we want to display at the user end as an output. Consider the below image:
    SAP ABAP Domain
    Here we have entered the CHAR data type, but we can choose any of the other data as per the requirement from the dropdown table. The No. Characters can be of any length. By filling the details when we click on enter, the Output Length will automatically be filled, which will be the same as the number of characters.
  • Step-6:
    Now click on the other tab Value Range. Consider the below image:
    SAP ABAP Domain
    We can maintain the value range by using this tab. Here we can define or fix any input, which we want to apply as the restriction for the end-user at the domain level. But for now, we will leave it as empty as we don't want any restriction.
  • Step-7: Now, all the important data has filled, so we can save it. For this, click on the save button given at the menu bar. It will open a new pop-up window, as shown in the below image:
    SAP ABAP Domain

If we want to put it inside a package, we can enter the package name that we have already created else save it as a Local Object. We will save it as a local object, which will save our domain successfully in the SAP system.

Note: When we save any object as a Local object, then that object cannot be shared among multiple SAP Servers.

  • Step-8: We can check it by clicking CTRL+F2, and if there is any problem, it will display the error else will show "No inconsistencies found." After that, we need to activate it by clicking the activate button or CTRL+F3. It will show the domain information, consider the below image:
    SAP ABAP Domain

Note: After creating any object in the SAP system, we must need to activate it; else, we will not be able to use it further either in any program or table.

Hence our domain is created successfully, and we can use it in any program or table. In further topics, we will learn to use the custom domain in a table.

Modifying the existing domain

Once the domain is created, we can also modify it by changing the technical attributes of the domain, such as Data Type, number of characters, number of decimal places, etc. When we make a change in any existing domain, these changes also reflect in all the database tables that contain any field related to that domain.

Below are the steps for modifying in the existing domain:

  • Step-1: Open the ABAP dictionary initial screen by using the SE11 transaction code. Enter the already existing domain in front of the domain object and click on the Change button given at the bottom of the screen. Consider the below image:
    SAP ABAP Domain
  • Step-2: Now, the existing domain will open. Click on the details that you want to modify and save the domain. Consider the below image:
    SAP ABAP Domain
    Here, we have changed the length of the character from 30 to 20 characters.
  • Step-3: Check for any error or inconsistency. To check the errors enter CTRL+F2. Consider the below image:
    SAP ABAP Domain
  • Step-4: Now activate the domain by clicking on the Activate option or by pressing CTRL+F3. Once it gets activated, we can use it in the programs and database tables. Consider the below image:
    SAP ABAP Domain

Note: These changes will be reflected in all the database tables that have any field related to this particular domain.

Deleting Domains in DDIC

We can also delete an existing domain from the SAP system. Below are the steps that are given to delete the domain from the system:

  • Open the ABAP dictionary initial screen by using the SE11 transaction code. Enter the already existing domain in front of the domain radio button.
  • Enter the domain name that you want to delete, and click on the Delete icon on the screen.
  • A pop-up window will appear, which will provide you three options. Consider the below image:
    SAP ABAP Domain
  • Click on the Yes, and the domain will be deleted from the system.





Latest Courses