Skip to content

ABAP Keyword Documentation →  ABAP - Release-Specific Changes →  Changes in Releases 4.0 and 4.5 

Internal Tables and Key Tables in Release 4.0

The following features of internal tables have been improved considerably in Release 4.0:

  • Performance improvements, particularly for large tables. This has been achieved by introducing hashed tables, whose access time is constant, mostly regardless of the number of table entries.
  • Introduction of sorted tables. This has removed the need for complex program code, whose tasks are now performed in the kernel.
  • Support for generic programming by introducing generic table types.

Other versions: 7.31 | 7.40 | 7.54

key tables

New table types STANDARD TABLE, SORTED TABLE, and HASHED TABLE

standard tablesSorted tables

Generic table types INDEX TABLE and ANY TABLE

To allow generic programming, there is a hierarchy based on the basic internal table types listed above. The generic type INDEX TABLE includes standard and sorted tables. The type ANY TABLE can be used for any table.

Furthermore, further generic types can be defined by omitting the row type, key, or uniqueness attribute of a table (see TYPES). This enables the types of parameters to be defined in generic procedures.

Typing procedure parameters

Since the old internal table type corresponds to the new standard table, only standard tables can be passed to a TABLES parameter. The new tables types can be passed to FORM and FUNCTION parameters using the additions USING or CHANGING or the additions IMPORTING, EXPORTING, and CHANGING.

New table operations

Entries in key tables are located using their key. This means that it must also be possible to add, modify, and delete table entries using the appropriate table key. The following new table operations have therefore been introduced:

  • READ   TABLE ... [FROM ...|WITH TABLE KEY ...]
  • DELETE TABLE ... [FROM ...|WITH TABLE KEY ...]

The new operations are valid for all table categories and are, in this respect, generic (for details of the semantics, refer to the corresponding keyword documentation). In each of the statements, the key can be specified using a work area, either explicit or implicit (table with header line). The key values are then taken from the work area. In the statements READ and DELETE, the key can be specified explicitly in the form

... WITH TABLE KEY k1 = v1 ... kn = vn

Unlike the previous form of the READ statement, "WITH KEY k1 = v1 ... kn = vn", the new form must specify the key in full. This is tested within the syntax check.

The syntax of the new operations has been modeled as far as possible on the existing statements for reading, inserting, modifying and deleting table entries. Note the following rules of thumb:

  • In the new operations, the word TABLE comes directly before the table name itself
  • Use the addition WITH TABLE KEY to specify the key explicitly

Integration of the new table types

The new table types can be used both in the new table operations listed above and in existing ABAP statements. This means that the following statements can also be used on key tables:


This translation does not reflect the current version of the documentation.