Standard Keys in Internal Tables
-
In internal tables, the standard key basically comprises all tables fields
with character-like types (type (
C, STRING,
D, T, N,
X, XSTRING).
In particular, components with a numeric type (also refer to ABAP numeric types) and table components usually do not belong to the standard key.
-
The standard key of an internal table with a nested line structure is formed by making the nested line
structure into a linear structure. Each sub-structure is recursively merged into the structure one level
up until there is only level consisting of unstructured table fields. The fields that are neither numeric
nor table fields are then used to form the standard key.
The following example should make this process of 'linearization' clear:
TYPES: BEGIN OF PERSONNEL_DATES,
NAME
TYPE STRING,
BIRTHDAY
TYPE D,
WEIGHT
TYPE F,
END OF PERSONNEL_DATES,
BEGIN OF ADDRESS,
STREET
TYPE STRING,
CITY(30)
TYPE C,
END OF ADDRESS,
BEGIN OF PERSON_RECORD,
NUMBER(10) TYPE P,
DATES TYPE PERSONNEL_DATES,
ADR TYPE ADDRESS,
END OF PERSON_RECORD.
DATA: ITAB TYPE PERSON_RECORD OCCURS 100.
-
The standard key for the internal table ITAB comprises
the fields
ITAB-DATES-NAME, ITAB-DATES-BIRTHDAY,
ITAB-ADR-STREET and ITAB-ADR-CITY.
The fields ITAB-NUMBER and ITAB-DATES-WEIGHT are not part of the standard key.
-
In the case of tables of non-structured types (i.e. tables with an elementary line type like
C, I or P),
REF TO etc.), the complete line is used as the standard key.
For tables of tables, the standard key is empty.