ABAP Keyword Documentation → ABAP - Short Reference
TYPES - Short Reference
Other versions: 7.31 | 7.40 | 7.54
Syntax
TYPES dtype[(len)] {TYPE { {abap_type [LENGTH len]
[DECIMALS dec]}
| {[LINE OF] type}
| {REF TO type}
| { {{[STANDARD] TABLE}
|{SORTED TABLE}
|{HASHED TABLE}}
OF [REF TO] type
[WITH [UNIQUE|NON-UNIQUE]
{ {KEY [primary_key [ALIAS key_name]
COMPONENTS] comp1 comp2 ...}
| {DEFAULT KEY} }]
{[WITH {UNIQUE HASHED}|{{UNIQUE|NON-UNIQUE} SORTED}
KEY key_name1 COMPONENTS comp1 comp2 ...]
[WITH {UNIQUE HASHED}|{{UNIQUE|NON-UNIQUE} SORTED}
KEY key_name2 COMPONENTS comp1 comp2 ...]
...}
[{WITH|WITHOUT} FURTHER SECONDARY KEYS]
[INITIAL SIZE n]}
| {RANGE OF type [INITIAL SIZE n]} }
| {dbtab { READER|LOCATOR|{LOB HANDLE} }
| { WRITER|LOCATOR } FOR
{ COLUMNS blob1 blob2 ... clob1 clob2 ... }
| { ALL [OTHER] [BLOB|CLOB] COLUMNS }
[...]}}
| {LIKE { {[LINE OF] dobj}
| {REF TO dobj}
| { {{[STANDARD] TABLE}
|{SORTED TABLE}
|{HASHED TABLE}
|{ANY TABLE}
|{INDEX TABLE}}
OF [REF TO] dobj
[WITH [UNIQUE|NON-UNIQUE]
{ {KEY [primary_key [ALIAS key_name]
COMPONENTS] comp1 comp2 ...}
| {DEFAULT KEY} }]
{[WITH {UNIQUE HASHED}|{{UNIQUE|NON-UNIQUE} SORTED}
KEY key_name1 COMPONENTS comp1 comp2 ...]
[WITH {UNIQUE HASHED}|{{UNIQUE|NON-UNIQUE} SORTED}
KEY key_name2 COMPONENTS comp1 comp2 ...]
...}
[{WITH|WITHOUT} FURTHER SECONDARY KEYS]
[INITIAL SIZE n]}
| {RANGE OF dobj [INITIAL SIZE n]} }}.
Effect
Defines a data type dtype
.
Additions
-
(len)
Determines the length when referring to generic ABAP types. -
TYPE
Determines the type by referring to a data type. -
LIKE
Determines the type by referring to a data object. -
[LENGTH len] [DECIMALS dec]
Determines the length and the number of fractional portions when referring to generic ABAP types. -
LINE OF
Reference to the row type of an internal table. -
REF TO
Generates a reference type. -
{[STANDARD] TABLE}|{SORTED TABLE}|{HASHED TABLE}|{ANY TABLE}|{INDEX TABLE}
Generates a table type for non-generic table types standard, sorted or hashed tables or for the generic table typesANY TABLE
orINDEX TABLE
. -
WITH {[UNIQUE|NON-UNIQUE] {KEY [primary_key [ALIAS key_name] COMPONENTS] comp1 comp2 ...}}|{DEFAULT KEY}
Defines a unique or non-unique primary table keyprimary_key
. The components of the key are either specified explicitly or are defined by a standard key. You can useALIAS
to define an alias namekey_name
. -
WITH {UNIQUE HASHED}|{{UNIQUE|NON-UNIQUE} SORTED} KEY key_name COMPONENTS comp1 comp2 ...
Defines a secondary table keykey_name
. It is managed using either a unique hash algorithm, a unique sorted secondary index, or a non-unique sorted secondary index. -
{WITH|WITHOUT} FURTHER SECONDARY KEYS
Defines the genericness of the table type with respect to the secondary table key. -
INITIAL SIZE n
Defines the initial memory usage of an internal table. -
RANGE OF
Derives a ranges table with the row type of a selection table. -
READER|WRITER|LOCATOR|{LOB HANDLE} FOR ... COLUMNS ...
Derives an LOB handle structure from the structure of a database table.