Skip to content

ABAP Keyword Documentation →  ABAP Programming Guidelines →  Robust ABAP 

Internal Tables

An internal table is a dynamic data object consisting of a sequence of rows with the same data type. The data type of an internal table is a table type that has the following basic properties of every internal table:

  • Row Type
The row type can be any data type. In particular, tables of
elementary types, tables of structures, tables of tables, and
tables or references are all possible.
  • Table Category
The table category specifies the type of storage and primary access. The possible table categories are:
  • Standard tables administered using a primary table index and which cannot have a unique primary table key.
  • Sorted tables administered using a primary table index and that can have a unique or non-unique primary table key (used to sort the table).
  • Hashed tables whose primary table key always has to be unique and which use a hash algorithm (distributed memory management) to administer their rows. A hashed table does not have a primary table index.
  • Primary Table Key
Every internal table has a primary table key. A table key consists of columns from the internal table. The content of these columns identifies table rows. The table category determines whether a key is unique or non-unique.

Internal tables enable variable datasets (a variable number of rows) with a fixed structure (the row type) to be edited in the working memory of the internal session of a program. The content of an internal table can either be accessed sequentially in a LOOP or by accessing inidividual rows (for example, by using READ TABLE).

There are two ways of accessing individual rows:

  • By specifying a key (a table key or a free key)
  • By specifying a row index

Primary table access is possible for all three table categories. Access using the primary key, however, is optimized only for sorted tables and hashed tables. In standar tables, primary key access uses a linear search. Access using the primary row index, on the other hand, is possible for standard tables and sorted tables only. As well as its primary key, an internal key can also have further secondary keys. These keys enhance and optimize access options to the various table categories.

Other versions: 7.31 | 7.40 | 7.54

Continue

Selecting the Table Category

Secondary Key

Initial Memory Requirements

Sorted Filling

Collected Filling

Output Behavior

Loop Processing