sapdev logo background
sapdev logo sapdev logo
Comments

ABAP CREATE DATA ITAB Statement syntax, information and example SAP source code



Return to Statement index



CREATE DATA - TABLE OF

Short Reference

ABAP Syntax_5 CREATE DATA dref [
area_handle ]
{ {TYPE [STANDARD]|SORTED|HASHED TABLE OF [REF TO] {type|(name)}}
| {LIKE [STANDARD]|SORTED|HASHED TABLE OF dobj} }

[ WITH { {[UNIQUE|NON-UNIQUE]
{KEY {comp1 comp2 ...}|(keytab)}|
{DEFAULT KEY}}}
| {EMPTY KEY} ]
[INITIAL SIZE n].

What does it do? The statement CREATE DATA uses the addition
tabkind OF to create an internal table. The meaning of the additions is the same as when declaring internal tables using the statement DATA , but with special rules for CREATE DATA if dobj is specified after LIKE . The explicit definition of the primary table key is only optional if a standard table is being generated.
Whereas all the specifications for DATA have to be static, the following dynamic specifications can be made for CREATE DATA :
The row type after TYPE or the static type of a row flagged as a reference variable after TYPE REF TO can have a character-like data object called name . In this case, the same rules apply as in the other variants of CREATE DATA .

The definition of the primary table key can specify a parenthesized internal table keytab instead of a static component comp1 comp2 ... :

... WITH [UNIQUE|NON-UNIQUE] KEY (keytab) ...

The table keytab must have a character-like data type and must contain the name of a valid component in each row or the identifier
table_line for the primary table key in a single row.

A numeric data object can be specified for n after INITIAL SIZE .
Latest notes: The definition of the table key is subject to the following conditions in comparison to DATA :

No secondary table keys can be defined in the statement CREATE DATA .

The name primary_key and the addition COMPONENTS cannot be specified explicitly in the definition of the primary key.
Use Run Time Type Creation
instead to create dynamic table types with secondary keys. The same applies to creating an empty table key dynamically, since the internal table keytab can only be used to define non-empty keys.

Example ABAP Coding See Creating Tabular Data Objects .
Documentation extract taken from SAP system, � Copyright SAP AG. All rights reserved




CREATE_DATA_IMPLICIT
CREATE_DATA_REFERENCE




comments powered by Disqus