0% found this document useful (0 votes)
4 views39 pages

A Brief Introduction To ABAP Data Dictionary by Richa Solanki Medium

This document provides an overview of the ABAP Data Dictionary in SAP, detailing its components such as tables, views, data types, and how to create database tables. It explains the significance of various objects within the Data Dictionary, including database tables, views, and data elements, along with step-by-step instructions for creating these components. The document serves as a comprehensive guide for understanding and utilizing the Data Dictionary in SAP ABAP development.

Uploaded by

jimmyharsha7
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views39 pages

A Brief Introduction To ABAP Data Dictionary by Richa Solanki Medium

This document provides an overview of the ABAP Data Dictionary in SAP, detailing its components such as tables, views, data types, and how to create database tables. It explains the significance of various objects within the Data Dictionary, including database tables, views, and data elements, along with step-by-step instructions for creating these components. The document serves as a comprehensive guide for understanding and utilizing the Data Dictionary in SAP ABAP development.

Uploaded by

jimmyharsha7
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 39

Open in app Sign up Sign in

A brief introduction to ABAP Data Dictionary


16 min read · Jul 13, 2020

Richa Solanki Follow

Listen Share

In the previous article on SAP ABAP, we studied the fundamentals of SAP ABAP.

With my second blog series, I am trying to put together the most crucial term,
called the Data Dictionary in SAP ABAP.

From this blog, you’ll learn:

SAP ABAP Data Dictionary Overview

SAP ABAP tables

SAP ABAP create database tables


15 2

SAP ABAP Views

SAP ABAP Data types

SAP ABAP Type Group

SAP ABAP Search help

SAP ABAP Lock Object

SAP ABAP Data Dictionary Overview


ABAP Data Dictionary (DDIC) is the central repository for data definition in SAP
systems. In the data dictionary, you can create and maintain objects that are
related to the database.

Anything you see in SE11, including tables, data elements, domains, search helps,
views, structures, table types, lock objects are all DDIC objects. Below is the
screenshot of SE11.

Now let’s understand each object in general.

Database tables: Database tables are made up of rows and columns. Database
tables are the collection of fields that have technical attributes as well as the
semantic description. The custom tables (by user) should start with the
naming convention as ‘Z’ or ‘Y.’ All the standard tables (by SAP) start with
other names except Z or Y.
View: A view is a virtual table, which does not have any physical existence. It
is created by combining the data of one or more tables. A view does not
occupy any storage space.

Table type: A table type is a global reusable object, ie, we declare in SE11
Tcode, which is used to define the structures and functional attributes of an
internal table in ABAP. To learn more about the internal table, navigate to
‘Part 3’.

Data type: Data type includes the following list.

Type Group: To encapsulate similar type pools in one group, we make type
group. The inbuilt type pools provided by SAP are SLIS, SAP.

Domain: Domain describes the technical attributes such as data types and
lengths of a table field.

Data element: Data element in sap ABAP gives the semantic description of
fields such as field labels and documentation. It describes how the field can
be displayed to the end-user.

Search Help: To enable the list of entries for one field or many fields, we use
the search help option. The function key for search help is F4.

Lock Objects: To control the parallel access for the same data by multiple
users, we make use of the lock objects. Lock objects in the data dictionary
(DDIC) start with ‘E.’

Table vs Structure

SAP ABAP tables


As discussed earlier, SAP ABAP tables are a collection of fields that are in the
format of rows and columns. Every field is made up of a data element and a
domain.

While declaring fields in the database table, all the primary keys should come
together in the beginning.

NOTE: Maximum key fields should be 16. Total fields in a table can be 294.

The standard database tables provided by SAP are as follows:

VBAK — Sales Document: Header Data

VBAP — Sales Document: Item Sata

SFLIGHT — Flight

SPFLI — Flight schedule

KNA1 — Customer Details

MARA — General Material Data

MARC — Plant data for materials


Further, the types of table in SAP ABAP are as follows:

1. Transparent tables

2. Pool tables

3. Cluster tables

Transparent tables: It has a one-to-one relationship. This type of table is used to


store application data.

Pool tables: It has a many-to-one relationship. Many pool tables are clubbed and
stored in a single table in a database. This type of table is used to store control
data.

Cluster tables: It has a many-to-one relationship. Many cluster tables are clubbed
and stored in a single table in a database.

Creating database tables in SAP ABAP


The following are the steps for creating the custom tables.

Execute the Tcode ‘SE11’.

Once the screen gets loaded, select the ‘database table’ radio button and
provide the name for the table. Remember, the naming convention should
start from ‘Z’ or ‘Y’ to indicate its the custom table.
Further, click on the Create button and enter the short description. Choose
the delivery class as ‘A.’ Also, choose the ‘Display/Maintenance allowed’ from
the dropdown.

The delivery class in SAP ABAP determines whether the data of the table can
be transported or not. Types of the delivery class are as follows:

1. A — Application table (Master and transactional data)

2. C -Customer table, maintenance only by the customer, no SAP imports.

3. L -Table for storing temporary data

4. G -Customizing, protected against SAP updates

5. E -Control table

6. S -System table, edited only by SAP

7. W -System table

NOTE: We usually use the delivery class as ‘A’ since it contains both master ad
transactional data. Master data is needed alot but changes seldomly. Transactional
data is also used alot and changes frequently.

Navigate to the ‘Fields’ tab to enter the fields of the table. Now there are two
options to provide data types to each field, mainly by data element or by
predefined data type.

Below is the method via the ‘data element.’

Field: List all the fields which are required for the table. Primary keys should
come at the start.

Key: Tick the checkbox for the fields which are primary.

Data element: All the data elements will start with ‘Z’ as the naming
convention.
Further, double click on every data element to provide a short description
along with the domain name. The naming convention of the domain should
start from ‘Z.’
As discussed, the data element in sap ABAP provides the semantic description
of the fields. Hence one should always provide the field label. Hence navigate
to the field label tab and provide 4 types of lengths:

1. Short

2. Medium

3. Long

4. Heading
Navigate again to the data type tab and double click on the domain which you
provided. Provide a short description and data type of the particular field.
The domain also provides the option of the value range, which acts as the
dropdown list for the particular field. Provide the ranges and click on save
and hit the activate button.

Also, save and activate the data element. Repeat this procedure for every
individual field by providing data elements, field labels, domains.
Now click on the ‘Technical settings’ button or hit ‘Ctrl+shift+F9’. Here, we
provide the data class and size category.

Data class: This is the physical area in the database where all the data of the
table are stored. With the help of the data class, SAP segregates and organizes
the tables according to their types of data. It keeps all the master data
together, all transaction data together, all user data, and all organization data
together. This increases system performance. Following are the types of data
class:

1. APPL0 -Master data ( Data which changes seldomly)

2. APPL1 -Transactional data (Data which changes frequently)

3. APPL2 -Organization data (Customizing data that is defined when the system
is installed and seldomly changed.

Size category: This determines the expected size required for the table. The
default size for type ‘0’ is 8 KB.
Save, activate, and hit on the ‘No’ button.

We are done with the creation of a table. Now to create entries in a table,
navigate to Utilities > Table contents > Create entires.

Fill the entires one by one and hit the save button.
Once all the entries are created, go back and hit the Contents button
(Ctrl+shift+F10) and click on the execute icon (F8).

OUTPUT:

SAP ABAP Views


As discussed earlier, views are virtual tables. There are four types of ABAP views.

Database views: This type of view creates a join between two or more tables
based on common fields. Moreover, Database Views are only meant for
reading purposes.
Projection views: This type of view does not join any tables. It simply uses one
table and shows the output to the user. This view is meant for both reading
and writing purposes.

Maintenance views: This view is the same as the Database view. Maintenance
views generate the screen runtime for maintaining and displaying records.

Help views: This is a special view for use in search helps (F4).

Steps to create Database View

Navigate to SE11 transaction. Choose the radio button which says ‘View.’ Give
a suitable name for the same. Ensure the naming convention should start
from ‘Z’ or ‘Y.’ Once done, click on the create button.

You will get the screen which has various types of views. Here we will go for
the ‘Database View.’
Give a short description. Next, provide the name of the master table (KNA1),
click on the relationship button, and select the dependent table (VBAK). Once
we select two tables, we get the join condition automatically. Here the join
condition is on fields ‘Mandt’ and ‘Kunnr.’

NOTE: Since database view enables joins of 2 tables, hence we have an option of
relationship button.

Further, navigate to View Fields tab and mention the fields which you want to
display to the user from both the tables. In our example, the two tables are
KNA1 and VBAK.

NOTE: The above screenshot will throw an error since there is a blank space in the
view field of customer ID. Hence ensure it write as ‘customer_ID’.

Save and hit the activate icon (Ctrl +F3). Navigate to the Utilities tab located on
the menu bar and click on the contents option. The below screen gets
displayed.
The below output displays the entries for the fields ‘Customer’ and ‘Name.’
There is no entry for the fields ‘City’ and ‘Sales document.’

Steps to create Projection View

Naviagte to SE11 > choose ‘View’ radio-button >Projection view.


Enter the short description and provide the base table. Here we are using the
‘KNA1’ table in our Projection view example. Click on the ‘Table fields’ button
and provide the fields which you want to display to the user.

NOTE: There is no word as a ‘relationship’ since the projection view is meant for only
one table.

Further, click on the maintenance view and ensure the selected radio-button
is read and change.

Save and activate and hit the utilities from the menu bar to view the contents.

Steps to create Maintenance View

Naviagte to SE11 > choose ‘View’ radio-button >Maintenance view.


Provide a short description. Enter the base table as KNB1 and click on the
‘relationship’ button.

Select the suitable checkbox and click on the ‘copy’ button. Save and hit the
activate icon.
Further, go to the Utilities tab > table maintenance generator.

Add the Authorization group — suni

Maintenance screen — One step > Overview screen > 1.

Click on the ‘create’ icon, which is located to the extreme left besides ‘Find
SCR. Number’

Further, go back and select utilities > contents. The last step is to select the
‘maintain’ button.
Lastly, maintain the entries.

SAP ABAP Data types


Following is the segregation of global data types on navigating to SE11.
Since we have already seen the creation of a data element previously, here we will
concentrate on the creation of a structure.

Steps to create a simple global structure


Click on the ‘data-type’ radio button. Provide the appropriate name. Hit the
‘Create’ button.

Once the screen gets loaded, we have three options to go for. We will select
the ‘Structure’ radio button.

Provide a short description and type the fields which you want to use in the
structure. Here I have used built-in data types for the fields ‘EMP_NAME’,
‘EMP_NO,’ and ‘LOCATION.’
Save and hit the activate icon (Ctrl +F3).

Now, we will consume this structure in our report. So navigate to SE38 and
copy-paste the below snippet.

LOGIC:

*& — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — —
— — -*
*& Report ZRDS_STRUCTURE
*& — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — —
— — -*
*&
*& — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — —
— — -*
REPORT ZRDS_STRUCTURE.
DATA : EMPLOYEE TYPE ZRDS_STRUCTURE.
EMPLOYEE-EMP_NAME = ‘SAP.’
EMPLOYEE-EMP_NO = ‘12346879’.
EMPLOYEE-LOCATION = ‘MUMBAI.’
WRITE:/ EMPLOYEE-EMP_NAME, / EMPLOYEE-EMP_NO, / EMPLOYEE-LOCATION.

OUTPUT:
Steps to create a global nested structure
Let’s use the existing structure. Here, I have added the field ‘EMP_ADDRESS’.

Double click on the data element (ZRDS_ADDRESS) and add the fields. Save,
check, and activate.
Once adding all the fields of nested structures, you will be able to see the
icon.

Now, we will consume this structure in our report. So navigate to SE38 and
copy-paste the below snippet.

LOGIC:

*& — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — —
— — -*
*& Report ZRDS_STRUCTURE_NESTED
*& — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — —
— — -*
*&
*& — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — —
— — -*
REPORT ZRDS_STRUCTURE_NESTED.
DATA : EMPLOYEE TYPE ZRDS_STRUCTURE.
EMPLOYEE-EMP_ADDRESS-EMP_CITY = ‘MUMBAI’.
WRITE: EMPLOYEE-EMP_ADDRESS-EMP_CITY.

OUTPUT:
Steps to create SAP ABAP Type Groups
In a type group, we can declare all the local data types and constants that can be
consumed in different programs.

Rather than writing local types, one prefers making the type groups that
consolidate all local types.

NOTE: Type group is a 5 char name.

ABAP type groups can be created by navigating to SE11 transaction and


enabling the type group radio button.

Enter the short description. Save and copy-paste the below code snippet.
LOGIC:

TYPE-POOL ZRDS1.
TYPES : BEGIN OF ZRDS1_KNA1,
KUNNR TYPE KNA1-KUNNR,
LAND1 TYPE KNA1-LAND1,
NAME1 TYPE KNA1-NAME1,
END OF ZRDS1_KNA1.
TYPES: BEGIN OF ZRDS1_VBAK,
VBELN TYPE VBAK-VBELN,
ERDAT TYPE VBAK-ERDAT,
END OF ZRDS1_VBAK.

Further, we will consume this type group in our SE38 report.

LOGIC:

*& — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — —
— — -*
*& Report ZRDS_TYPE_POOL
*& — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — —
— — -*
*&
*& — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — —
— — -*
REPORT zrds_type_pool.
TYPE-POOLS : zrds1.
DATA : it_kna1 TYPE TABLE OF zrds1_kna1,
wa_kna1 TYPE zrds1_kna1.
SELECT kunnr land1 name1 FROM kna1 INTO TABLE it_kna1 UP TO 5
ROWS.
LOOP AT it_kna1 INTO wa_kna1.
WRITE: / wa_kna1-kunnr, wa_kna1-land1, wa_kna1-name1.
ENDLOOP.

OUTPUT:
SAP ABAP Search help
There are two types of search helps:

1. Elementary search help: Based on one single field, we can populate the data
for the rest of the fields if the table.

2. Collective search help: This collects several elementary search helps. Hence,
Collective search help provides an alternative search path for a particular
field.

Listed below are the steps to create Elementary search help.


Enable the search help radio button and provide the appropriate name. Click
on the ‘create’ button.
Once the screen gets loaded, we will get 2 options. Here go for the elementary
search help.

Give a short description. Enter the table name in the selection method. Here I
have used the table (ZRDS_EMPLOYEE), which was created earlier. Further,
change the option of dialog type to ‘display values immediately.’ Entering the
hotkey is optional.

Next, enter the fields on which we want to populate the search help (Hit F4 to
get the list of fields). Here I have used all fields of the table
(ZRDS_EMPLOYEE).

Provide ‘LPos’ (List position) and ‘SPos’ (Screen position) between 0 to 7.


Save, activate the search help, and go back to the database table on which we
have implemented search help.

Select the field on which you want a search help. Here, I have done search
help on EMPLOYEE_ID. Hit the search button. Enter the Search help name
which you created prior.
Hit the ‘Create Proposal’ button and click on the ‘Copy’ button, which is
located at the extreme bottom.
Once the search help is implemented successfully, the below message will
popup.

Further, navigate to contents and press F4 on the EMPLOYEE_ID field to get


the list of data. This is the final output.
Below are the steps to create Collective search help.
Enable the search help radio button and provide the appropriate name. Click
on the ‘create’ button. Choose the Collective Search Help radio button.

For Collective Search Help, we need to create more than 1 elementary search
help. Here I have already created two Elementary search helps.

To start with, navigate to Included Search helps tab. Mention all the
Elementary search helps.

Save it and navigate to the ‘Definition’ tab.


Enter any single field from both the elementary search helps and navigate
again to ‘Included Search help.’ Select the first search help and click on the
parameter assignment. Hit yes and copy.

Repeat the same for the second search help.

Save and hit the activate icon and execute it the same way as elementary
search help.
NOTE: At one time, only a single search help can be applied to a single field.

Lock objects in SAP ABAP


Lock object in SAP ABAP is the feature used to control access of the same data to
multiple users.

NOTE: When lock objects are enabled, 2 function gets created namely, ENQUEUE and
DEQUEUE.

Lock objects are of three types.

1. Read lock: All of them can only read the data.

2. Write lock: Only one user can write while the rest can read.

3. Exclusive but not cumulative: Only one lock can be requested by a


transaction. All the other requests are rejected.

Below are the steps to create Lock Objects.


Navigate to transaction SE11 and enable the lock object radio button. Provide
an appropriate name. Ensure you follow the naming convention by starting
with the letter ‘E.’

Further, provide a short description and enter the table name. Here I have
used the table (ZRDS_EMPLOYEE), which was created prior. Apply the lock
mode as write.
Navigate to the ‘Lock parameter’ tab, and you will get the display of only
primary keys.

NOTE: Lock objects are applied only to primary keys.

Further, save and press F3. Once the lock objects are activated, by default, two
function modules are created.

To watch the function modules, click on the GoTo tab from the menu bar and
click on lock modules.
NOTE: To release the lock, navigate to transaction SM12.

I hope the above explanation gives the individual a brief knowledge of the Data
Dictionary in SAP ABAP.

Sap Abap Training Abap Data Dictionary

You might also like