SAP DATA - Reference ABAP Statements

Get Example source ABAP code based on a different SAP table
  


Standard SAP Help for DATA

DATA

ABAP Reference
ABAP Code Snippet


ABAP Syntax DATA var[(len)] [TYPE { {abap_type [LENGTH len]

[DECIMALS dec]}
| {[LINE OF] type [BOXED]}
| {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 EMPTY 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 ...]
...}
[INITIAL SIZE n]
[WITH HEADER LINE]}
| {RANGE OF type [INITIAL SIZE n]
[WITH HEADER LINE]}
| {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}}
OF [REF TO] dobj
[ {WITH [UNIQUE|NON-UNIQUE]
{ {KEY [primary_key [ALIAS key_name]
COMPONENTS] comp1 comp2 ...}
| {DEFAULT KEY} }}
| {WITH EMPTY 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 ...]
...}
[INITIAL SIZE n]
[WITH HEADER LINE]}
| {RANGE OF dobj [INITIAL SIZE n]
[WITH HEADER LINE]} }]
[VALUE { val | {IS INITIAL} }]
[READ-ONLY].
ABAP Code Snippet

What does it do? Declares a variable or an instance attribute var.

ABAP Addition (len)
Defines the length when referring to generic predefined ABAP types.
TYPE
Defines the type by referring to a data type.
LIKE
Defines the type by referring to a data object.
[LENGTH len] [DECIMALS dec]
Defines the length and number of fractional portions when referring to generic predefined ABAP types.
LINE OF
Defines the type by referring to the row type of an internal table.
BOXED
Declares a structure as a static box .
REF TO
Creates a reference variable.
{[STANDARD] TABLE}|{SORTED TABLE}|{HASHED TABLE}
Creates a standard, sorted, or hashed table.
WITH {[UNIQUE|NON-UNIQUE] {KEY [primary_key [ALIAS key_name] COMPONENTS] comp1 comp2 ...}}|{DEFAULT KEY}
Defines a unique or non-unique primary table key primary_key. The components of the key are either specified explicitly or are defined by a standard key. You can use ALIAS to define an alias name key_name.
WITH EMPTY KEY
Defines an empty primary table key.
WITH {UNIQUE HASHED}|{{UNIQUE|NON-UNIQUE} SORTED} KEY key_name COMPONENTS comp1 comp2 ...
Defines a secondary table key key_name. It is managed using either a unique hashed algorithm, a unique sorted secondary index, or a non-unique sorted secondary index.
INITIAL SIZE n
Defines the initial memory usage of an internal table.
WITH HEADER LINE
Obsolete: Defines a header line of the same name for an internal table.
RANGE OF
Defines a ranges table with the row type of a selection table.
VALUE { val | {IS INITIAL} }
Defines a start value of the data object as val or as the initial value.
READ-ONLY
Protects non-private attributes from write accesses outside of their own class.
READER|WRITER|LOCATOR|{LOB HANDLE} FOR ... COLUMNS ...
Derives an LOB handle structure from the structure of a database table.

Return to menu