Secondary table keys can be defined for table types in the ABAP Dictionary as well as for internal tables.
Possible secondary table keys are hash key and sorted key. Secondary keys can be divided into three categories depending on their uniqueness and the way they are accessed:
An internal table can have up to 15 secondary table keys with different names.
We recommend secondary keys for internal tables that are filled once and rarely changed during program execution.
Each secondary key has a unique name that must meet the naming conventions. This name cannot be either of the predefined names PRIMARY_KEY or LOOP_KEY.
The names of secondary keys and a possible alias name of the primary key must be unique.
Extras
You have the following possibilities for the definition of secondary keys:
This addition makes a table (independent of its primary key) generic in terms of its secondary keys.
This addition identifies the internal table declared as not generic in terms of its secondary keys.
The table is generic in terms of its secondary keys only if it is also generic in terms of its primary key.
If a table is already generic in terms of its primary key, the WITH FURTHER SECONDARY KEYS addition is superfluous but can be specified.
If a table is not generic in terms of its primary key, the WITHOUT FURTHER SECONDARY KEYS addition is superfluous but can be specified.
This definition can also be specified in the ABAP Dictionary. To do this, perform the following:
If you have already defined 15 secondary keys, you cannot declare the WITH FURTHER SECONDARY KEYS addition.
See also: