DATA - TYPE abap_type

Syntax

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

Effect

By specifying a predefined data type abap_type, an elementary variable var is defined. For abap_type, you can use all predefined data types from the table of predefined ABAP types, except b and s.

Syntax and meaning of LENGTH, len, DECIMALS and dec are identical to the definition of elementary data types with TYPES, but are used here to create a bound data type. If you omit for the ABAP types c, n, p and x the specification of len and dec, the bound type is created with the default length from the table of predefined ABAP types, and for p without decimal places.

As of release 6.10, you can use the VALUE addition to specify start values for data objects of type string and xstring. For xstring, only IS INITIAL can be defined as a start value.

Note

For purposes of legibility, it is recommended not to omit any specifications, and to always use the LENGTH addition instead of brackets for the length specification len.

Example

These statements declare three variables and determine their start values.

DATA: text_buffer TYPE string VALUE `Text`,
      count TYPE i VALUE 1,
      price TYPE p LENGTH 8 DECIMALS 2 VALUE '1.99'.