SAP KEYNAME

Get Example source ABAP code based on a different SAP table
  


ARTICLE

Internal Tables - keyname
The name of the table key can be specified in several statements and in table expressions for the editing of internal tables. The table key name can used to access a table row or to control processing. The following syntax applies to the label keyname:

Syntax
... key_name | (name) ...

Effect
The name of a table key can either be specified directly, as key_name, or dynamically, as the contents of a parenthesized character-like data object name (not case-sensitive).
You can specify:
a secondary table key using its name
the primary table key using its predefined name primary_key
the primary table key using an alias
the table key used in a LOOP-loop using its predefined name loop_key. In this case, the statement must be executed within the loop.

Notes
Normally secondary table keys are specified. Only if searches are to be performed explicitly in a table expression using the primary table key does the key need be specified using its predefined name primary_key or an alias name.
When specifying the primary table key using primary_key, it is important to note that it may be empty for standard tables. This can produce unexpected behavior in statements where the key is used to specify the rows to be processed.