This is the fifth blog post in this series. Here is the previous blog post
Getting started with ABAP: How to Create Table Part 1
In the previous blog post, we learned what is delivery class and its types. Also, we learned what is data browser/table view editing.
In this blog post you will learn how to create data elements and domain with fixed values.
How to Create Data Element
Second Method
Step 1: Go to transaction SE11.
Step 2: Click on Data Type
Step 3: Here we are creating second data element for employee_name field which we will add in our table. Enter the Data Element name. I have given ZAK_DE_EMP_NAME. Click on Create.
Step 4: Here you can see three options are there. We want to create Data Element hence click on data element and Press Enter.
Step 5: Enter short description. Now we will give data type through domain.
For that we have to create domain.
Enter domain name. Here I entered ZAK_DM_EMP_NAME. Double click on the domain name.
Step 6: It will ask you to save. Save it
Step 7: It will ask you to create domain. Click on Yes.
Step 8: Enter short description. Enter data type as CHAR and number of characters 25.
Step 9: Save and activate it. And click on back. You will get below screen. Here domain is created.
Step 10: Now enter field label. And save it and activate it.
Here Data element is created.
Step 11: Go to SE11. And select database table and enter database table name which is created earlier and click on change.
Step 12: Enter field name as Employee_name you can give any name and enter data element name which is created earlier. Press enter.
How to give fixed values to field
Step 1: There is another way to create a domain. Go to SE11. Select domain.
Step 2: Enter Domain name. I entered ZAK_DM_Gender.
Step 3: Click on Create. Enter short description, data type and no of characters.
Step 4: Click on Value Range tab. Here you can give fixed values at domain level.
Here I am creating domain for Gender field. So, this field can have two values Male and Female and that is fixed. I don’t want any other value to be stored in Gender field. Hence, I want to give fixed values.
Step 5: Mention two fixed values. i.e. Male & Female. Save and Activate it.
Use of fixed value is while entering the data into table I can only enter Male and Female. Other values will not accept it.
There is option as Intervals. Use of Intervals is we can define range of values.
For example. Employee id should be from 0 to 999.
So, enter 0 in lower limit and 999 in upper limit. Then this field will accept only the values from 0 to 999.
Here we have created the domain.
Step 6: Go to SE11. Click on database table and open the table ZAKtable which is created earlier.
Step 7: Enter field name as Gender. Enter data element name ZAK_DE_GENDER.
Double click on data element name. It will ask you to save this and create data element.
Create data element.
Step 8: Give short description and enter domain name which is created ZAK_DM_GENDER.
Step 9: Give Field label, save it and activate it.
Here Data Element is created.
I am going to continue this blog post in next blog post.
Here you can check next blog post
Getting started with ABAP: How to Create Table Part 3
Follow my profile to be notified of the next blog post. Please feel free to ask any questions you have in the comments section below.