ABAP Keyword Documentation →  ABAP − Reference →  Declarations →  Declaration Statements →  Data Types and Data Objects →  Declaring Data Objects →  DATA → 

DATA - TABLE OF

Short Reference

Syntax

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].

Effect

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.

Notes

Example

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' ].

...




Continue
DATA - tabkeys