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:
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:
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:
In the given DICTIONARY MAINTAIN SCREEN, we have entered the Short description, which is the general description of the 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.
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:
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: