≡ Menu

ABAP Internal Table Overview and Create tables

Overview of SAP ABAP Internal Table

An internal table, like a database table, is made of one or more rows of the same structure. While a database table holds data, an internal table does not hold any data even after the execution of the program. An internal may hence be regarded as a temporary storage area or as a temporary buffers where data can be modified as and when required. Internal tables occupy memory only at run-time and not when they are declared.

Internal tables make it possible for data from one or multiple database tables to be processed within a program. The number of lines contained by an internal table or its size varies, and depends on the the program associated with it.

Internal tables perform calculations on the data present in the fields of database tables . You retrieve data from a database table and store the same in an internal table. After doing so you may perform calculations – such as addition – on it.

Internal tables are also data types and data objects. A data type is nothing but an abstract description of a data object.

Work Area

To access an internal table, one must understand the concept of work area. A work area is a temporary space in the memory space where you can read and modify the data in an internal table, line by line. It must have the same structure as that of the internal table that is associated with it.

Structure of an Internal Table

The structure of an internal table has two parts – a body and a header line. A header line works as an implicit work area of the internal table However, a header line is optional. You can have an internal table with or without a header line. When the internal table is created along with a header line, a work area of same name as the internal table and same data type as the lines of the internal table is created. When internal table is created without a header line, work area has to be created explicitly by the programmer.

The table has a body and an optional header line, body holds the rows of the internal table. The header line is a buffer that is used to hold a record before it is added to or retrieved from an internal table. It holds only one row, which is a field string which has the same structure as a row of the body.

Types of Internal Table

Internal tables can be categorized into three types: standard tables, sorted tables, and hashed tables.

1. Standard Tables

Standard tables have a linear index. Here the records are accessed by using a table index or key. These tables have a non-unique key. To add data to a Standard table, you use the APPEND statement.

2. Sorted Tables

Sorted tables are similar to standard tables, but are sorted with a key. You can access the records of a sorted table by making use of a table index or key. Here, the key is either unique or non-unique and you use the INSER statement to add data to it.

Sorted and standard tables use indexes and are therefore also called index tables.

3. Hashed Tables

Hashed tables have no linear index and are accessed using a hash algorithm. Hashed tables are used when you want to process large volumes of data. Hash tables are non-indexed tables.

How to create an internal table:

# Create the internal table as a data type and then create a data object which refers to that data type – For this you should use the TYPES statement to create the data type, create the data object using the DATA statement and link the two by using TYPE or LIKE statements.

# Directly create the internal table data object – For this you should create the internal table using DATA and OCCURS statement.

The OCCURS clause defines the body of an internal table by declaring the fields for the table .

#To create an internal table with a header line, use either the BEGIN OF clause before the OCCURS clause or the WITH HEADER LINE clause after the OCCURS clause in the definition of the internal table.

#To create an internal table without a header line, use the OCCURS clause without the BEGIN OF and WITH HEADER LINE clauses.

Given below is an example of a simple internal tables.








S_EMPNO-LOW = ‘100’.

S_EMPNO-HIGH = ‘105’.






WRITE :/10 it_itab-zempno,it_itab-zempname,it_itab-zempsal.


So briefly explained how to create internal table in SAP ABAP.