TYPES - tabkeys
Short Reference
ABAP Syntax ... [ WITH key ]
[ WITH secondary_key1 ] [ WITH
secondary_key2 ] ...
[ {WITH|WITHOUT} FURTHER SECONDARY KEYS ] ... .
ABAP_ADDITIONS:
1 ... WITH FURTHER SECONDARY KEYS
2 ... WITHOUT FURTHER SECONDARY KEYS
What does it do? Defines the table key of a table type. The following can
be defined:
A primary table key using
key .
Up to 15 secondary table keys
using secondary_key1 ,
secondary_key2 , ... .
The order in which the components of a table key are defined is
significant for the table type. The
WITH|WITHOUT FURTHER SECONDARY
KEYS additions determine the genericness with respect to the
secondary table key.
An internal table that has no table key or an incomplete table key is
generic with respect to the table key. A table type of this nature can
be used only for typing formal parameters or
field symbols. For DATA , a standard
table type with a generic primary table key can be specified after
TYPE . In this case, a bound table type with a
standard key is created.
Primary Key
The genericness of a table type with respect to the primary key is
determined as follows:
If no WITH key declaration is
made, a table type is generic with respect to the primary key.
If a declaration about the uniqueness of the key is not made in
key , a table type is partially generic
with respect to the key.
If a key declaration with a uniqueness declaration is made in
key , a table type is not generic with
respect to the primary key.
The non-generic table categories can be split up as follows:
If no primary key is declared for standard tables, this primary key is
generic with respect to the key fields and defined implicitly as
non-unique.
If no primary key is declared for sorted tables, this primary key is
generic with respect to the key fields and uniqueness.
If no primary key is declared for hashed tables, this primary key is
generic with respect to the key fields and uniqueness; note, however,
that fixed hash tables can have only one unique key.
Secondary Key
The genericness of a table type with respect to the secondary key
depends (by default) on the genericness of the primary key; you can
override it with the WITH|WITHOUT FURTHER SECONDARY KEYS
additions.
If the primary key is completely or partially generic, then the table
type is by default generic with respect to the secondary key. The
standard behavior can be expressed using the WITH FURTHER SECONDARY
KEYS addition. However, if the WITHOUT FURTHER SECONDARY KEYS
addition is declared, the table type is generic with respect to the
primary key but not with respect to the secondary key.
If the primary key is not generic, then the table type is not generic
with respect to the secondary key either (by default). The standard
behavior can be expressed using the WITHOUT FURTHER SECONDARY KEYS
addition. If, however, WITH FURTHER SECONDARY KEYS is
declared, the table type is generic with respect to the secondary key
but not with respect to the primary key.
Latest notes: A generic table type cannot be used as a component of a
structured type .
ABAP_ADDITION_1 ... WITH FURTHER SECONDARY KEYS
What does it do? This addition defines the table type explicitly as being
generic with respect to the secondary key. This means it includes table
types that can have further secondary keys and not just the optional
secondary keys declared using WITH
secondary_key ... .
If you have already defined 15 secondary keys, you cannot declare the
WITH FURTHER SECONDARY KEYS addition.
ABAP_ADDITION_2 ... WITHOUT FURTHER SECONDARY KEYS
What does it do? This addition defines the table type explicitly as being
non-generic with respect to the secondary key. This means it includes
only those table types that have those secondary keys declared using
WITH secondary_key ... .
Documentation extract taken from SAP system, � Copyright SAP AG. All rights reserved