We cannot use Domain directly neither in a Report/Program nor as a table field. We need to add some semantic information i.e. Field Label, heading, etc. For this purpose we need data elements.
Data Elements are reusable objects that are used to add Field Label, Heading, Documentation (F1 Help) and assign a parameter ID and a Search Help (F4 Help).
Note: In Domain Level also we have an option to define Search Help which fetches either fixed value defined there or from Value Help Table while the one we assign in Data Element is from Global Search Helps that we create via SE11.
Creation of Data Elements:
#Using ABAP Dictionary
Step 01: Open SE11.
Step 02: Click Data type Radio Button and give your Data Element name starting with Z or Y e.g. “ZBarry_DataElement”.
Step 03: Click Create, Choose Data Element Radio Button and Enter explanatory description for Data Element in Short Description e.g. “Data Element for Test”. This short Text appears as title of Data Element F1 help Documentation.
Step 04: Under Data Type Tab, you will have two options. Choose any one and provide its corresponding details.
|Elementary type: It is used to define Data Element on the basis of either Domain or predefined Data types.|
|1. Domain||Enter your Domain Name||It adds technical characteristics in Data Element same as that of Domain.|
|2. Predefined Type||Enter Data Type & Length||Data Type can be any predefined data types with any length.|
|Reference Type: It is used to create a pointer to data objects.|
|1. Name of Ref. Type||Name of Class, Interface, Object, ANY or Data||The Data Element will point to the given Value.|
|2. Reference to Predefined Type||Enter Data Type, Length and Decimal Places||Data Type can be any Predefined Data Type like CHAR, INT and Length & Decimal Places can be of any length.|
Step 05: Add your Search Help, Parameter ID, Default Component Name and Mark your Data Element as a change document under Further Characteristics tab. For more read ABAP Documentation.
Step 06: Add Short, Medium, Long, Heading field label under Field Label tab. Field Label is used to display the name of fields in Parameters of Report, column Header of Table & structure. The purpose of providing different Labels is that these labels are displayed according to input template size.