Domains and Data Elements

 

Domains

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

  1. goto SE11, select Domain radio button, provide a name for it. Ex. ZDO_ROLLNUMBER and click Create button
  2. In the maintenance screen provide the short text
  3. Under Definition tab, provide Technical attributes like Data Type and length
  4. Under value range tab, provide single values or ranges which can appear as Search help windows.
  5. Finally Save and Activate.
  6. Use the Data Domain in creating Data Elements.

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

  1. goto SE11, select Data type Radio button, provide a name for Data Element, and click Create button. Ex. ZDE_ROLLNUMBER.
  2. select the radio button Data element and click continue
  3. In the maintenance screen provide short description and enter Data Domain name
  4. Under field label tab, provide text that can appear as column heading / field label
  5. finally save and Activate.
  6. Use this data element to create fields for Table / Structures

 

Comments

Popular posts from this blog

Sample ABAP program for Updating notepad file data to Internal table and Sending it to Application server

OPEN SQL EXAMPLES IN ABAP – PART 2