A domain provided Technical attributes (type, length and possible values) for a field. The definition of domain in ABAP is same as that in Mathematics.
In the world of Mathematics, a domain is defined as the set of input values that are valid for a given function. The same holds true for domains in ABAP. To understand this, let us first see what is the role of domains in ABAP data dictionary.
Domains -> Data Elements -> (Structures, DB tables, program references etc.)
Domains are attached to data elements and data elements are in turn attached to structures or tables. Lets say we have a field called ‘Gender’. The valid gender types will be ‘Male’ or ‘Female’. Thus, for domain ‘Gender’ the values will be ‘Male’ and ‘Female’.
Now this domain can be attached to a data element which in turn can be used in many structures and tables.
Creating a Data Domain
- goto SE11, select Domain radio button, provide a name for it. Ex. ZDO_ROLLNUMBER and click Create button
- In the maintenance screen provide the short text
- Under Definition tab, provide Technical attributes like Data Type and length
- Under value range tab, provide single values or ranges which can appear as Search help windows.
- Finally Save and Activate.
- Use the Data Domain in creating Data Elements.
A data element provides semantic attribute ( a meaningful description) for a field. The data element description appears beside a field in a table definition. These descriptions are language-dependent (unlike field names). Even more importantly, the data element provides field headings for use on screens. When you “paint” a dictionary field on a screen, you can automatically have the data element field headings appear. This permits the end user to see meaningful field descriptions.
The advantage of using a data element to describe fields and provide field headers is that the data element can be used more than once. For example, SAP R/3 contains many tables that have the field KUNNR. In cases like this, it is not necessary to enter the description for KUNNR many times. Each instance of KUNNR can be assigned to the same data element, and the field description only needs to be specified once. Additionally, if the description needs to be changed, it must be changed only once, and all fields referring to that data element automatically use the new description.
In addition to providing field descriptions and headers, data elements can provide detailed field documentation. This documentation is maintained at the data element level and is available to a user who hits F1 when the cursor is in field assigned to the data element.
To maintain this documentation, navigate to the Change Data Element screen within the ABAP Dictionary and click the Documentation push-button.
Creating a Data Element
- goto SE11, select Data type Radio button, provide a name for Data Element, and click Create button. Ex. ZDE_ROLLNUMBER.
- select the radio button Data element and click continue
- In the maintenance screen provide short description and enter Data Domain name
- Under field label tab, provide text that can appear as column heading / field label
- finally save and Activate.
- Use this data element to create fields for Table / Structures