Skip to content

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

DATA - TYPE abap_type

Quick Reference

Other versions: 7.31 | 7.40 | 7.54

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 built-in data type abap_type, an elementary variable var is defined. For abap_type, all built-in data types can be used except the internal types b and s.

The syntax and meaning of LENGTH, len, DECIMALS, and dec are identical to the definition of elementary data types using TYPES and must be specified within the defined areas. Here, however they are used to create a bound data type. If len or dec are not specified for the ABAP types c, n, p, and x, the bound type is created using the type-friendly standard length and, for p, without decimal places.


Notes

  • For reasons of legibility, it is best to include all information and always use the addition LENGTH (and not parentheses) to specify the length len.
  • The non-specifiable internal types b and s can be applied by referencing the built-in data types INT1 and INT2 in ABAP Dictionary.

Example

These statements declare three variables and define their start values.

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