We are hiring and constantly growing! Have a look through our vacancies to find the right role for you!
... ${UNIQUE HASHED$}$|${UNIQUE SORTED$}$|${NON-UNIQUE SORTED$}
KEY key_name $[ALIAS alias_name$] COMPONENTS comp1 comp2 ...
Definition of a secondary table key with an internal table type. An internal table can have up to 15 secondary keys.
Types of Secondary Keys
There are three types of secondary keys that are distinguished by the type of access and their uniqueness:
Names of Secondary Keys
Each secondary key has a unique name with which it can be addressed. The name must be specified directly as key_name and must comply with the naming conventions. The name specified cannot be one of the predefined names primary_key or loop_key. In addition, the names of secondary keys and any alias name for the primary key must be unique.
Key Fields
The key fields of the secondary key can be defined in the following ways, whereby the order is significant:
In an operation that changes the content of individual lines of an internal table, the key fields of a secondary table key are read-only only if the secondary key is used during this operation.
Use secondary keys in a way that benefits the table.
Definition of a table type with a primary key and two secondary keys hash_key and sort_key. The primary key in a standard table must not be unique. The secondary key hash_key has the same components as the primary key and must be a unique hash key. The sorted key sort_key could also be defined as unique, but this is not beneficial in the example shown here, since a customer ID can appear more than once in the reservation table. The two syntax forms shown here differ in the specification of the name primary_key for the primary key, but they have the same meaning.
Syntax form without the name primary_key specified:
Syntax form with the name primary_key specified:
The program DEMO_SECONDARY_KEYS demonstrates the declaration and use of a secondary table key and the resulting performance gains.
... ALIAS alias_name
An alias name alias_name can be defined for each secondary key of an internal table. The alias name is in the namespace of the secondary key, must comply with the naming conventions, and must be unique. It cannot be one of the predefined names primary_key or loop_key. It enables the secondary key to be addressed by means of an additional self-defined name.
An alias name is part of the technical type attributes of a table type. Two table types with otherwise identical technical attributes, but different alias names, are not compatible.
Definition of a secondary key carrname with an alias name carriername. Both names can be used in the USING KEY addition of a LOOP statement.
Leave us your contact details and we will call you back. Fields marked with * are mandatory.
We offer holistic SAP solutions from a single source to shape digital change and develop new business areas.
Switzerland
Schaffhausen
Germany
Mannheim, Düsseldorf, Munich
USA
Haverhill
Greece
Thessaloniki