Javatpoint Logo
Javatpoint Logo

ABAP Database Tables

What is the database table in ABAP?

  • A database table is an object type in DDIC that can be defined independently of a database in the ABAP dictionary, which stores the actual data in the matrix form of rows and columns.
  • The name of the custom table in DDIC must start with a letter z or y and can have a maximum of 16 characters. The table name can consist of any letter, number, or underscore.
  • Each row of the table is called a record, and each column of the table is called the field.
  • The field of the table is the combination of the data elements and domain and can be defined with their data type and length.
  • When this table is activated in DDIC, the SAP system creates a physical copy of its field in the database also. The table is automatically translated into the format that is compatible with the actual database. We can see the relationship between the table and the actual database in the below figure:
ABAP Database Tables

Note: To better understand the ABAP tables, first learn about the data elements and domain given in previous chapters.

Components of Table in ABAP DDIC

The components of the ABAP table are given below:

ABAP Database Tables

Delivery Class:

  • Delivery class is used to define the type of data that we want to store in our table. The data can be business data, which means Application data (Master and transaction data). We will choose the application data for our delivery class.

Display/Maintenance:

  • This option is used to allow us that whether we want only display the data or also want to maintain the data. Here the data maintenance means creating, deleting, or updating the data. There are three options available for this field:
    • Display/maintenance allowed
    • Display/maintenance not allowed
    • Display/maintenance allowed with restrictions

Field Name: The name which we provide to each field in the table is known as the field name that consists of a maximum of 16 characters. Similar to the table name, it must start with a letter, and can have a letter, numbers, and underscore.

Key Flag: It specifies whether that particular field belongs to the Key field or not.

Field Length: It defines the number of characters that can be entered into the field.

Decimal Places: It specifies how many digits are permitted after the decimal point, and it can only be used for the numeric data.

Short text: It specifies the meaning of the particular field entered within the table.

Data class: It defines the actual area of the table inside the database. The options available for the data class are given below, which we can select according to our table:

Data Class Description
APPL0 Master Data, Transparent Tables
APPL1 Transaction Data, Transparent Tables
APPL2 Organizing & Customizing

Domain: The domain is an object that defines the technical information of the field, such as data type and length. Learn More.

Data Element: The data element is an object that specifies the semantic information of the field, such as description, labels, etc. Learn More.

Types of ABAP Tables

In the ABAP dictionary, we can create three types of tables:

  • Transparent Tables
  • Pooled Tables
  • Cluster Tables

We can also create some special table types apart from these three tables, such as table pools and clusters. These two table types store the information of other tables such as program parameters, temporary data, documentation text, etc.

The explanation of the ABAP tables is given below:

1. Transparent Table

ABAP transparent table contains the application data that represents the master data or transaction data used by an application. A table of vendors or table of customers is an example of the master data.

In transparent tables, the database table has the same name and the same number of fields with field names as the data dictionary table.

The transparent table shows the one-to-one relationship with the table definition in the SAP database. The below image is showing the transparent table in ABAP:

ABAP Database Tables

2. Pooled Tables

The pooled table in ABAP shows the many-to-one relationship with the table definition in the database, which means for a single table defined in the SAP database, there are various tables in the ABAP dictionary.

The names of the tables stored in the Dictionary and the database must be different.

The SAP database stores all the Pooled tables in a single table, which is known as a table pool.

The pooled tables in the data dictionary may or may not have a common primary key field.

Below image shows the relation between the Pooled tables and table pools:

ABAP Database Tables

3. Cluster Tables:

Cluster tables are similar to the Pooled tables, as they also show the many-to-one relationship with the table definition in the SAP database. All the cluster tables are stored in a single table in the database, and that table is known as a table cluster.

The tables in the data dictionary must have at least one primary key field in common, and the table is usually accessed simultaneously.

The relationship between the cluster table and table clusters can be understood by using the below diagram:

ABAP Database Tables

The key difference between the Pooled, Cluster, and Transparent tables:

Pooled and cluster tables do not usually hold the application data as the transparent table; instead they are used to store the system data, such as system configuration information, historical data, etc.

Creating a table in ABAP

The basic steps are given below; the practice of this is given in further topic:

  • Open the ABAP dictionary initial Screen by navigating the menu path or entering the SE11 transaction code.
  • Click on the database table option, enter the name, and click on the Create
  • Give the short description
  • Specify the delivery class as "A."
  • Select the "Display/Maintenance Allowed" in Data Browser/Table view Maint. Option
  • Click on the Save button, and save it as Local object or provide the Package name.
  • Click on Fields Tab and enter the field name, and data element name.
  • Click on the Technical Settings buttons, and provide the required details
  • Click on save.
  • At last, activate the table.

Creating Records in the Table:

Once we create the table successfully in DDIC, we can now enter data in the table. Below are the steps for creating records in the table:

  • Open the ABAP dictionary initial Screen by navigating the menu path or entering the SE11 transaction code.
  • Enter the table name and click on the change button.
  • Click on the "Utilities" →Table ContentsCreate
  • Provide the details as per your requirement in the given fields and click on save.
  • Enter the details as much you want to save by resetting the fields.

Displaying the Records of Table

After creating the records in the table, we can easily display all the records saved in the table.

  • Open the ABAP dictionary initial Screen by navigating the menu path or entering the SE11 transaction code.
  • Enter the table name and click on the change button.
  • Click on the "Utilities" →Table ContentsDisplay
  • Click on the execute button given on the screen to view all records stored within the table.
  • We can also see the particular data if there are lots of records in the table, for that enter some data details and press enter.

Note: In this section, we have only provided the theory about creating and editing table. But the practical Implementation for creating a table and displaying is given in further topic.







Youtube For Videos Join Our Youtube Channel: Join Now

Feedback


Help Others, Please Share

facebook twitter pinterest

Learn Latest Tutorials


Preparation


Trending Technologies


B.Tech / MCA