Wednesday, 24 June 2020

The ABAP Data Dictionary

Here is a guide to using tables, we use this within our internal courses, I haven’t run one for some time with the lockdown in the UK, but I share it here for the benefit of others in this wider SAP community.

Tables can be defined independent of the database in ABAP Dictionary. When a table is activated in ABAP Dictionary, a similar copy of its fields is created in the database as well. The tables defined in ABAP Dictionary are then translated automatically into the format that is compatible with the database, because the definition of the table depends on the database used by the SAP system.

A table can contain one or more fields, each defined with its data type and length. The large amount of data stored in a table is distributed among the several fields defined in the table.

Types of Table Fields


A table consists of many fields, and each field contains many elements. The following table lists the different elements of table fields:

SAP ABAP Tutorial and Material, SAP ABAP Learning, SAP ABAP Guides, SAP ABAP Exam Prep

To create a Table in SAP follow these steps:-

Step 1: Go to transaction SE11, select the ‘Database table’ radio button, and enter a name for the table to be created. In our case, we have entered the name ZSTUDENT1. Click the Create button. The Dictionary: Maintain Table screen appears. Here the ‘Delivery and Maintenance’ tab is selected by default.

SAP ABAP Tutorial and Material, SAP ABAP Learning, SAP ABAP Guides, SAP ABAP Exam Prep

SAP ABAP Tutorial and Material, SAP ABAP Learning, SAP ABAP Guides, SAP ABAP Exam Prep

Step 2: Enter an explanatory short text in the Short Description field for example Student Table for learning purposes.

SAP ABAP Tutorial and Material, SAP ABAP Learning, SAP ABAP Guides, SAP ABAP Exam Prep

Step 3: Then click the Search Help icon beside the Delivery Class field. Select ‘A [Application table (master and transaction data)]’ option.

SAP ABAP Tutorial and Material, SAP ABAP Learning, SAP ABAP Guides, SAP ABAP Exam Prep

Step 4: Select the ‘Display/Maintenance Allowed’ option from the ‘Data Browser/Table

SAP ABAP Tutorial and Material, SAP ABAP Learning, SAP ABAP Guides, SAP ABAP Exam Prep

view Maintenance’ drop-down menu. The Dictionary: Maintenance Table screen appears.

Step 5: Select the Fields tab. The screen containing the options related to the Fields tab appears.

SAP ABAP Tutorial and Material, SAP ABAP Learning, SAP ABAP Guides, SAP ABAP Exam Prep

Step 6: Now enter the names of the table fields in the Field column. A field name may contain letters, digits, and underscores, but it must always begin with a letter and must not be longer than 16 characters. Take care with this step.

The fields that are to be created must also have data elements because they take the attributes, such as data type, length, decimal places, and short text, from the defined data element.

Step 7: Select the Key column if you want the field to be a part of the table key. Let’s create fields such as CLIENT, ID, FIRST_NAME, LAST_NAME and AGE.

Step 8: The first field is an important one and it identifies the client which the records are associated with. Enter ‘Client’ as the Field and ‘MANDT’ as the Data Element. The system automatically fills in the Data Type, Length, Decimals and Short Description. The ‘Client’ field is made a key field by checking the ‘Key’ box.

SAP ABAP Tutorial and Material, SAP ABAP Learning, SAP ABAP Guides, SAP ABAP Exam Prep

Step 9: The next field is ‘ID’. In Data element type NUM8 and press enter. This will create the numeric data type with length 8. Click the Save button (optional).

SAP ABAP Tutorial and Material, SAP ABAP Learning, SAP ABAP Guides, SAP ABAP Exam Prep

Step 10: The next field is ‘FIRST_NAME’. In Data element type CHAR25 and press enter. This will create the character data type with length 25. Click the Save button (optional).

SAP ABAP Tutorial and Material, SAP ABAP Learning, SAP ABAP Guides, SAP ABAP Exam Prep

Step 11: The next field is ‘LAST_NAME’. In Data element type CHAR25 and press enter. This will create the character data type with length 25. Click the Save button (optional).

SAP ABAP Tutorial and Material, SAP ABAP Learning, SAP ABAP Guides, SAP ABAP Exam Prep

Step 12: The next field is ‘AGE’. In Data element type NUM2 and press enter. This will create the numeric data type with length 2. Click the Save button (optional).

SAP ABAP Tutorial and Material, SAP ABAP Learning, SAP ABAP Guides, SAP ABAP Exam Prep

Step 13: Click Save. It will ask for Transport Request. Click on Create Request (Give it any name you wish) Save it and activate the Table.

SAP ABAP Tutorial and Material, SAP ABAP Learning, SAP ABAP Guides, SAP ABAP Exam Prep

Step 14: When you Activate the Table you should then see the have ‘Maintain Technical Settings’ Screen.

In ‘Data Class’ select “Master data, transparent tables (APPL0)” and in ‘Size category’ you can then select any as per your requirements, here, in this example we have selected category 0.

SAP ABAP Tutorial and Material, SAP ABAP Learning, SAP ABAP Guides, SAP ABAP Exam Prep

SAP ABAP Tutorial and Material, SAP ABAP Learning, SAP ABAP Guides, SAP ABAP Exam Prep

Step 15: Click on ‘Revised<->Active’ Button and then Click on ‘Save’ Button.

SAP ABAP Tutorial and Material, SAP ABAP Learning, SAP ABAP Guides, SAP ABAP Exam Prep

And that is it.

No comments:

Post a Comment