Skip to content

ABAP Keyword Documentation →  ABAP - Reference →  Processing Internal Data →  Internal Tables →  Internal Tables - Overview 

Data Type of an Internal Table

A table type defined in ABAP Dictionary or using TYPES or DATA is specified fully using:

  • Row Type
    The row type of an internal table can be any data type. If the row type is structured, the individual components of a row are also known as the columns of the internal table.
  • Table Category
    The table category defines how an internal table is administered and how its individual rows can be accessed. There are three table categories:
  • Standard tables are administered internally using a primary table index. If required, this primary table index can be implemented using a logical index. The table can be accessed using either a table index or a table key. The primary key of a standard table is always non-unique. The response time for accessing the table using the primary key is proportional to the number of entries in the table. Secondary table keys can be defined to make key access to standard tables more efficient.
  • Sorted tables are also administered internally using a primary table index. They are always sorted according to the primary table key. The sort order is in ascending order by size and returns the same result as the SORT statement with no additions. The table can be accessed using either a table index or a table key. The primary key of a sorted table can be either unique or non-unique. The response time for accessing the table using the primary key is logarithmically proportional to the number of table entries, since a binary search is used.
  • Hashed tables are administered internally using a hash algorithm. Hashed tables can be accessed using a table key or a secondary table index. The primary key of hashed tables is always unique. The response time for primary key access is constant and independent of the number of entries in the table.
  • Table Key
    A table key is used to identify rows in a table (see below). There are two possible key types for internal tables, primary keys and optional secondary keys. Every internal table has a primary key, which is either the standard key or a self-defined key. Depending on the table category, the primary key is unique or non-unique. A secondary key is either a sorted key, which can be unique or non-unique, or a unique hash key. If keys are unique, a row with a specific content in the key fields can exist only once in the internal table. A table key can consist of components of the row type or of the entire row ( pseudo component table_line), if they are not internal tables or do not contain internal tables. When a table key is defined, the order of the key fields is significant.

Unlike all other data types, a table type defined in ABAP Dictionary or using TYPES does not have to be specified in full. Either only the keys or the row type and the keys can be omitted from the definition. This makes the type generic and it can be used only for typings of field symbols and formal parameters. The predefined generic ABAP types ANY TABLE and INDEX TABLE can be used for these purposes. The first type includes all table categories, the second type includes standard tables and sorted tables, known as index tables.

Like strings, internal tables are dynamic data objects. Their row type, table category, and table key are always specified in full, but the number of rows is variable and restricted only by the capacity of the system installation (see Maximum Size of Dynamic Data Objects).

Other versions: 7.31 | 7.40 | 7.54


Note

Table keys are evaluated when typings are checked. Only actual parameters that have the same type can be assigned to a formal parameter or a field symbol whose table type has a non-generic primary key or one or more secondary keys.