Internal Tables - Overview

What Are Internal Tables?

Internal tables are a way to store datasets of a fixed structure in the working memory of ABAP. The data is stored on a row-by-row basis, where each row has the same structure. The individual components of a row are also referred to as the columns of the internal table.

There are two kinds of internal tables in ABAP: data types and data objects. A data type returns the abstract description of an internal table and is used to create concrete data objects.

Data Types

Structures and internal tables represent the two structured data types available in ABAP (see ABAP Type Concept). The data type of an internal table is fully specified by:

Declaring Internal Tables

Like any other ABAP data object, internal tables can first be created as a data type ( TYPES statement) and subsequently as a data object, or they can be directly declared as a fully specified data object ( DATAstatement). When you create an internal table as a data object, bear in mind that this only declares the administrative entry for an internal table as static. Unlike with all other ABAP data objects, the size of the memory space required is, however, not yet determined. The actual table rows are dynamically generated at runtime through operational fill statements and removed through delete statements.

When declaring an internal table, you can control the memory requirements of the table using the OCCURS and INITIALSIZE additions. This may affect the response times for filling the internal table (see the Performance Notes for Internal Tables).

Internal Tables as Parameters for Routines

Like any other parameter, internal tables can be passed by value or reference to subroutines and function modules.

If you want to pass a table together with its header line to a subroutine, you must pass it by reference using the TABLES addition. However, only STANDARDtables are allowed as TABLES parameters.

If a STANDARD table without a header line is passed as an actual parameter to a formal parameter with a header line (TABLES), the system automatically creates a header line in the routine. If you want to pass the body of a table with a header line as an actual parameter to a formal parameter without a header line, however, you can do this by using angle brackets after the name as described above.