Skip to content

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

DATA - TYPE, LIKE

Short Reference

Other versions: 7.31 | 7.40 | 7.54

Syntax


DATA var { {TYPE [LINE OF] type} 
         | {LIKE [LINE OF] dobj} }
         [VALUE  val|{IS INITIAL}]
         [READ-ONLY].

Effect

When a type data type or a dobj data object is specified, the data type of variable var is already fully defined before the declaration. The syntax and meaning of the additions TYPE and LIKE are exactly the same as the definition of the data types with TYPES, except that:

If neither TYPE nor LIKE is specified, a data object with the bound data type c of length 1 is created.


Note

For internal tables, the declaration of the primary table key as a standard key can be critical for various reasons. It is best to define the key fields explicitly instead. In the statement above, therefore, check whether a table with standard key is created by mistake if using a generic standard table type.


Example

These statements define two data objects, both of which have the same data type as the database table spfli.

DATA: spfli_wa1 TYPE spfli, 
      spfli_wa2 LIKE spfli_wa1.