Saturday 30 September 2017

ABAP: Data Elements

In my previous post, I explained about the domains in ABAP Dictionary. I showed you how to create domains (ZRATING, ZDATE_OF_JOIN, ZID, ZEMAIL, ZMYNAME). This is continuation to my previous post, I recommend you to go through my previous post before reading this.

Domain VS Data Elements
Domain holds the technical details like data type, number of characters to store, case sensitivity, output length, value range etc., Data Elements holds the semantics of the filed like meaningful field names, description about the field etc.,

Domain
Corresponding data elements using this domain
ZRATING
ZSTUDENT_RATING, ZFACULTY_RATING
ZDATE_OF_JOIN
ZSTUDENT_DATE_OF_JOIN, ZFACULTY_DATE_OF_JOIN
ZID
ZSTUDENT_ID, ZFACULTY_ID, ZPARENT_ID
ZEMAIL
ZSTUDENT_PRIMARY_EMAIL, ZSTUDENT_SECONDARY_EMAIL, ZFACULTY_PRIMARY_EMAIL, ZFACULTY_WORK_EMAIL, ZPARENT_PRIMARY_EMAIL, ZPARENT_SECONDARY_EMAIL
ZMYNAME
ZSTUDENT_FIRST_NAME, ZSTUDENT_LAST_NAME, ZFACULTY_FIRST_NAME, ZFACULTY_LAST_NAME, ZPARENT_FIRST_NAME, ZPARENT_LAST_NAME

First let us create a data element 'ZPHONE_NUMBER' without using any domain, later I will show you how to create the data elemented mentioned in above table using corresponding domains.

Create ZPHONE_NUMBER data element with simple built in data type CHAR
Open ABAP dictionary by using the transaction SE11.


Select the check box ‘Data type’ and give the name as ZPHONE_NUMBER and click the button Create.
It opens below window. Choose the radio button 'Data Element' and press Ok.
It opens below screen.


As you see above screen, it is similar to the screen that we saw while creating domains.

Update ‘Short Description’ as ‘Phone number of a person’.
Select the check box ‘Built-in type’ and select the Char type and give length as 20 characters.
Go to ‘Field Label’ section, given some meaningful labels to this data element.
Save the changes and activate the data element. That’s it, you are done with the creation of first data element.

Creating data elements using domain
In my previous post, I created below domains.
a.   ZRATING
b.   ZDATE_OF_JOIN
c.   ZID
d.   ZEMAIL
e.   ZMYNAME
        
Now let’s create data elements using above domains.

Create ‘ZSTUDENT_PRIMARY_EMAIL´ data element using ZEMAIL domain
Open ABAP dictionary by using the transaction SE11.

Give the Data type as ‘ZSTUDENT_PRIMARY_EMAIL’ and click Create button.
It opens below window. Select the check box ‘Data element’ and press ok.
It opens below window. Add some ‘Short Description’ and add the Domain as ZEMAIL.
Update field labels.
Press Save and activate the data element. That’s it you are done.

Add documentation to data element
Open the Data element using ABAP dictionary. Click on the button ‘Documentation’.
It open editor like below.

Add some documentation and save.

Same way, you can create following data elements from the domains
Domain
Corresponding data elements using this domain
ZRATING
ZSTUDENT_RATING, ZFACULTY_RATING
ZDATE_OF_JOIN
ZSTUDENT_DATE_OF_JOIN, ZFACULTY_DATE_OF_JOIN
ZID
ZSTUDENT_ID, ZFACULTY_ID, ZPARENT_ID
ZEMAIL
ZSTUDENT_PRIMARY_EMAIL, ZSTUDENT_SECONDARY_EMAIL, ZFACULTY_PRIMARY_EMAIL, ZFACULTY_WORK_EMAIL, ZPARENT_PRIMARY_EMAIL, ZPARENT_SECONDARY_EMAIL
ZMYNAME
ZSTUDENT_FIRST_NAME, ZSTUDENT_LAST_NAME, ZFACULTY_FIRST_NAME, ZFACULTY_LAST_NAME, ZPARENT_FIRST_NAME, ZPARENT_LAST_NAME


Previous                                                 Next                                                 Home

No comments:

Post a Comment