Skip to content

ABAP Keyword Documentation →  ABAP − Reference →  Declarations →  Declaration Statements →  Data Types and Data Objects →  Types and Objects - Overview 

Data Types

Data types are a subtree of the ABAP type hierarchy. Data types are only type descriptions. They do not have any attached memory for storing working data, but they may require space for administration information. A data type characterizes the technical attributes of all data objects that have this type. In ABAP, data objects occur as attributes of data objects, but they can also be defined as standalone data types.

The definition of standalone data types is based on a set of built-in data types. Standalone data types can either be defined internally in the program using the statement TYPES in the global declaration part of a program, in the declaration part of a class, locally in procedures, or for all programs in the ABAP Dictionary. Data types in ABAP Dictionary are either created directly as repository objects or in a type group.

Built-in and self-defined data types can be used to create data objects and for typing. For the latter in particular, built-in generic data types are available. A generic data type is a data type that does not determine all attributes of a data object. Generic data types can only be used for typing formal parameters and field symbols.

Data types can be divided into elementary data types, reference data types, and complex data types.

  • Elementary types are 'atomic' in the sense that they are not composed of other types. They are further classified into elementary types of fixed length and of variable length.
  • There are 14 built-in elementary data types of fixed length in ABAP.

    There are eight numeric types, namely integers (b, s, i, int8), decimal floating point numbers (decfloat16, decfloat34), binary floating point numbers (f), and packed numbers (p).

    There are two character-like types, namely text fields (c) and numeric text fields (n).

    There is one byte-like type, namely byte fields (x).

    There are two character-like date and time types, namely date fields (d) and time fields (t).

    A time stamp type: Time stamp fields (utclong).

    The data types c, n, x, and p are generic in terms of length. p is also generic in terms of the number of fractional digits. The numeric data types b and s cannot be specified directly in programs for short integers.
  • Reference types describe data objects that contain references to other objects (data objects and instances of classes), which are known as reference variables. There are no built-in reference types in ABAP. A reference type must either be defined in the ABAP program or in ABAP Dictionary. Reference types form a hierarchy, which represents the hierarchy of the objects to which the references can point.
  • Complex data types are composed of other types. They enable the administration and processing of semantically related datasets under one name. A data object of a complex type can be accessed overall or by component. With the exception of the structure sy, there are no built-in complex data types in ABAP. A complex type must either be defined in the ABAP program or in ABAP Dictionary. There are two types of complex data type:
  • A structured type is a sequence of any elementary data types, reference data types, or complex data types. Structures are used for grouping together work areas that logically belong together.
  • Table types consist of a sequence of any number of rows of the same data type. Table types are characterized by a row type, which can be any elementary data type, a reference data type, or a complex data type. They are also characterized by the table type, which defines how tables can be accessed, and by a table key, which is used to identify the table rows.

Other versions: 7.31 | 7.40 | 7.54