TABKIND - Internal Table Types

Alternatives:

1. STANDARD TABLE

2. SORTED   TABLE

3. HASHED   TABLE

4. INDEX    TABLE

5. ANY      TABLE

Effect

The table type - set in the DATA, TYPES, orCREATE DATA statement, specifies how the system accesses entries in the internal table in generic key operations.
(READ TABLE itab, DELETE TABLE itab, INSERT TABLE itab, MODIFY TABLE itab, COLLECT itab). As a general rule, the runtime required for key operations depends on the total length of the key.

The various table types have the following hierarchy:

                         ANY TABLE
                             |
                   ---------------------
                   |                   |
               INDEX TABLE      HASHED TABLE
                   |
         ---------------------
         |                   |
    STANDARD TABLE      SORTED TABLE


Alternative 1

STANDARD TABLE


Effect

Defines the table as a standard table. Key access to a standard table uses a linear search. This means that the timne required for a search is in linear relation to the number of table entries.

You should use index operations to access standard tables.

For the sake of compatibility, you can use TABLE as a synonym of STANDARD TABLE.

Alternative 2

SORTED TABLE


Effect

Defines the table as one that is always saved correctly sorted. Key access to a sorted table uses a binary key. If the key is not unique, the system takes the entry with the lowest index. The runtime required for key access is logarithmically related to the number of table entries.

You can also access sorted tables by index operations. When you insert using an index, the system checks to ensure that the sort sequence has been correctly maintained. For this reason, it takes longer than inserting entries in a standard table. As a rule, you should only access sorted tables using their key.

Alternative 3

HASHED TABLE


Effect

Defines the table as one that is managed with an internal hash procedure. You can imagine a hashed table as a set, whose elements you can address using their unique key. Unlike standard and sorted tables, you cannot access hash tables using an index. All entries in the table must have a unique key. Access time using the key is constant, regardless of the number of table entries.

You can only access a hashed table using the generic key operations or other generic operations ( SORT, LOOP, and so on). Explicit or implicit index operations (such as LOOP ... FROM oe INSERT itab within a LOOP) are not allowed.

Alternative 4

INDEX TABLE


Effect

Standard and sorted tables belong to the generic class index tables. An index table is one that you can access using an index. You can currently only use the table type INDEX TABLE to specify the type of generic parameters in a FORM or a FUNCTION. Hashed tables are not index tables, and cannot therefore be passed to parameters defined as INDEX TABLE.

Alternative 5

ANY TABLE


Effect

Like INDEX TABLE, you use ANY TABLE to specify the type of any generic table parameter. The set of permitted operations for a table with type ANY TABLE consists of the intersection of all permitted operations for STANDARD, SORTED and HASHED TABLEs, and so is identical to the set of operations permitted for hashed tables.

Note in particular that you cannot use index access for tables with this type.

Additional help

Internal Tables