This is a continuation of the previous video here: Create A SAP Table Part 2. Watch that video first.
In this article we’re going to continue creating our first data table. In the previous article, we went through every single step to create our first field data element and domain. Now we’re going to continue creating the four additional fields but a little bit faster.
Field: SURNAME
The next field we want to create is the SURNAME field by keying in the word SURNAME. We don’t want to make this a key field, so do not check the box.
Under Data element, let’s create an element called ZSURNAME. We will do this by using forward navigation. To do so, just double-click on ZSURNAME. A pop-up window should come up. Choose Yes to save the table. Then choose Yes to create ZSURNAME as a data element when prompted by another pop-up window. Next, key in the Short text field with the text Surname Data Element.
We will create a brand new domain. We’ll use forward navigation again. Double click ZSURNAME. Choose Yes to save the data element when prompted. Assign it to the Local object development class. Choose Yes to create the domain. Then key in SURNAME in the Short text field.
We’re going to use a data type of character this time. Click the drop down menu to bring up the data types in the ABAP dictionary drop down box. Choose CHAR which is a character string. We want to set the number of characters to 40 and Output length to 40 as well. Hit the Enter key to make sure everything is okay and choose the Activate button, which is the little match stick icon on the tool bar. The Activate button will save the object for us.
A pop-up window should now appear. Again, choose the $TMP development class by clicking on the Local object button. The Inactive Objects window comes up then choose the object that we want to activate, the ZSURNAME domain. Click the green tick icon at the bottom of the window to continue. Check the status bar to make sure everything is activated correctly. And if it does then press the F3 key or hit the Back button to go back to the data element.
Make sure that the domain attributes have come through. You should see the Surname, CHAR, Length of 40 beside each field. Go to the Field labels tab. Enter Surname into every single field label. Press Enter. The length is automatically filled in, then activate your data element by clicking on the match stick icon.
Your data element will be selected in the inactive objects window again so just click the green tick icon to continue. Then check the status bar along the bottom to make sure everything is activated correctly. If it does press the F3 key to step back and you can see Surname data element and domain attributes have been brought through into our table entry.
Field: FORNAME
The next field we want to create is FORENAME and we’ll choose ZFORENAME for our data element. Double click the data element to create the object. Click Yes to save the table, and Yes again to create the data element. Enter some short text for the FORENAME data element. In this case enter Forename Data Element.
For the Domain, enter ZFORENAME. Double click the domain. Choose Yes to save the data element. Assign it to the Local object development class. Choose Yes to create the domain. Enter some short text for the domain, in this case, FORENAME. Then similar to the Surname field we created we’re going to choose a CHAR data type, a length of 40 characters and an output length of 40. Now activate the object. Assign it to the local development class.
Make sure your object is selected in the inactive objects window and choose the Continue button to activate the domain. And when activated successfully press the Back button to go back to the data element. Ensure that domain properties have come. And now going to the field label, enter the word Forename into all four field labels. Press Enter to automatically fill in the length of each field label, and then click the Activate button.
Select your data element in the inactive objects window and click the Continue button. Check the status bar. If everything has been activated successfully press the F3 key to step back to see your table. If you see the data element and domain properties have come through for these fields then we know everything is working correctly.
Field: TITLE
The next field we’re going to enter is one called TITLE. We’ll create a data element called ZTITLE. Double click the data element using forward navigation to create it. Choose Yes to save the table and Yes to create the data element. Enter Title Data Element short text for the title.
In the domain, create a brand new domain called ZTITLE. Double click it using forward navigation to create it. Choose Yes to save the data element. Assign it to the local object. Yes to create the domain. Fill in the short text by entering the word Title. In Data type, we want to use CHAR string again. But this time choose a length of 15 and an output length of 15 also.
Activate the domain. Assign it to the local development class. Ensure your domain is highlighted in the inactive objects window. Click the continue button. Once everything is activated press the F3 key to step back to the data element.
Click on the Field label and enter the word Title into each field label. Press enter to automatically fill in the length of each field label then activate your data element. Once again select the object in the objects inactive window and click the continue button. Once everything is activated successfully press the F3 key to step back to view your table.