sapdev logo background
sapdev logo sapdev logo
Comments

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



Return to Statement index



DATA - TABLE OF

Short Reference

ABAP Syntax_5 DATA itab { {TYPE [STANDARD]|SORTED|HASHED TABLE OF [REF TO] type}
| {LIKE [STANDARD]|SORTED|HASHED TABLE OF dobj} }
[ tabkeys ]
[INITIAL SIZE n]
[VALUE IS INITIAL]
[READ-ONLY] .

What does it do? This statement defines an internal table. The definition of the row type, table category STANDARD TABLE , SORTED TABLE , or HASHED TABLE and the initial memory size INITIAL SIZE corresponds exactly to the definition of table categories in the section
TYPES - TABLE OF . Using DATA , these additions generate a bound table type. The generic types ANY TABLE and
INDEX TABLE cannot be used with DATA .
tabkeys is used to define the table keys of the internal table, which, unlike data types, cannot be generic.

Latest notes: When an internal table is created as a data object, only the administration entry for an internal table is generated. The actual table rows are not inserted until runtime.

Several obsolete variants for declaring standard tables exist, described under Obsolete Declarations . In particular, note the obsolete use of the additions WITH HEADER LINE and OCCURS .

When an internal table is defined, the start value after the VALUE addition must be IS INITIAL
.

Example ABAP Coding Declares an internal hashed table. The row type corresponds to the structure of the database table SPFLI . Two key fields are defined for the primary table key. The other statements demonstrate how the table is filled with rows from database table SPFLI and how a row is read.
DATA: spfli_tab TYPE HASHED TABLE OF spfli
WITH UNIQUE KEY carrid connid,
spfli_wa LIKE LINE OF spfli_tab.

SELECT *
FROM spfli
INTO TABLE spfli_tab
WHERE carrid = 'LH'.

spfli_wa = spfli_tab[ KEY primary_key
carrid = 'LH' connid = '0400' ].

...
Documentation extract taken from SAP system, � Copyright SAP AG. All rights reserved




DATA_HEADER_LINE
DATA_KEYDEF




comments powered by Disqus