SAP® Documentation

Single view

ABAPDATA - DATA

ABAP Short Reference   Fill RESBD Structure from EBP Component Structure  
This documentation is copyright by SAP AG.
SAP E-Book

DATA

Short Reference



Syntax Forms



Using built-in types

1. DATA ${ ${var$[(len)$] TYPE abap_type $[DECIMALS dec$]$}
       $| ${var TYPE abap_type $[LENGTH len$] $[DECIMALS dec$]$} $}
       $[VALUE val$|${IS INITIAL$}$]
       $[READ-ONLY$].

Reference to existing types

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

Enumerated variables

3. DATA enum_var ${ ${TYPE enum_type$}
                $| ${LIKE enum_dobj$} $}
                $[VALUE val$|${IS INITIAL$}$]
                $[READ-ONLY$].

Reference variables

4. DATA ref ${ ${TYPE REF TO type$}
           $| ${LIKE REF TO dobj$} $}
           $[VALUE IS INITIAL$]
           $[READ-ONLY$].

Structures

5. DATA BEGIN OF struc $[READ-ONLY$].
     ...
     DATA comp ...
     INCLUDE ${TYPE$|STRUCTURE$} ...
     ...
  DATA END OF struc.

Internal tables

6. DATA itab ${ ${TYPE tabkind OF $[REF TO$] type$}
            $| ${LIKE tabkind OF dobj$} $}
            $[tabkeys$] $[INITIAL SIZE n$]
            $[WITH HEADER LINE$]
            $[VALUE IS INITIAL$]
            $[READ-ONLY$].

Ranges table

7. DATA rtab ${TYPE RANGE OF type$}$|${LIKE RANGE OF dobj$}
            $[INITIAL SIZE n$]
            $[WITH HEADER LINE$]
            $[VALUE IS INITIAL$]
            $[READ-ONLY$].

LOB handle structures

8. DATA dtype TYPE dbtab$|view $[READ-ONLY$]
                   lob_handle_type FOR lob_handle_columns
                 $[ lob_handle_type FOR lob_handle_columns
                  ...                                   $].


Static boxed components

9. DATA struc TYPE struc_type BOXED.

Effect

The statement DATA declares a variable of any data type. The declared data object is visible within the current context as of this position. Within the declaration part of a class or an interface, DATA declares an instance attribute whose validity is bound to an instance of a class.

This statement has various syntax forms, which allow elementary data types, reference types, structured types, and table types to be defined. With the exception of two additions (VALUE and READ-ONLY), these are the same syntax forms as in the statement TYPES. In this way, a new data type can be defined when declaring a data object. The most important difference compared with the statement TYPES is that a data type defined using DATA (and not derived from an existing type) is available only as a property of the declared data object and is not a standalone data type. This kind of data type is bound to its data object.

For the definition of a structure struc, any data declarations specified are enclosed in two DATA statements with the additions BEGIN OF and END OF. Here a structure struc is declared that contains the enclosed data objects comp as a struc-comp component. Structure definitions can be nested.

The naming conventions apply to the names var, ref, struc, comp, itab, and rtab.

Notes

  • Data objects that are declared in a program, but cannot be accessed there statically, produce a warning message in the enhanced program check.

  • An inline declaration of variables can be made using the declaration operator DATA.

  • The obsolete variant DATA ... COMMON PART declares interface work areas.









General Data in Customer Master   CPI1466 during Backup  
This documentation is copyright by SAP AG.

Length: 8652 Date: 20200120 Time: 113525     sap01-206 ( 60 ms )

Our Service

Looking for Support? Questions?

The

Consolut

Callback-Service

Leave us your contact details and we will call you back. Panels marked with * are mandatory.