SAP NetWeaver AS ABAP Release 740, ©Copyright 2014 SAP AG. All rights reserved.
ABAP Keyword Documentation →
ABAP − Reference →
Processing Internal Data →
Internal Tables →
Internal Tables - Overview →
Selection of Table Type
What kind of table should be used in an individual case depends on the type of individual row access that will be used most often on the table. These rules are correspondingly relativized for tables with
secondary keys.
- Standard Tables
This kind of table is appropriate when the individual entries can be addressed using the
index. Access via the index is
the fastest possible access to table entries. You should fill standard tables by appending lines using
APPEND and implement the other accesses using an index specification
(INDEX addition of the respective statements). Since the cost of accesses
to standard tables via the primary key increases linearly with the number of table entries, this type
of access should only be used on standard tables if the filling of the table can be separated from the rest of the processing. If a standard table is sorted after filling, the cost of a key access with a binary search
(BINARY SEARCH) has a logarithmic relationship to the number of table entries.
- Sorted Tables
This kind of table is appropriate if the table must
be sorted from the time of creation. The filling of the table takes place by insertion using the
INSERT statement and in accordance with the sort sequence defined by
the primary table key. The cost of key accesses is related logarithmically to the number of table entries because a binary search is automatically carried out. Sorted tables are also particularly suited for partially sequencial access in a
LOOP loop, if the first part of the table key is specified in the WHERE condition.
- Hashed Tables
This kind of table is suitable when key accesses are
the central operation to be carried out on the table. Hashed tables cannot be accessed using a primary
table index. However, the cost per key access is always constant and independent of the number of table
entries. As with database tables, the key of hashed tables is always unique. Therefore hashed tables
are suitable for creating internal tables that are similar to databases and can be used in a corresponding fashion.