Data types are a subtree of the ABAP type hierarchy.
Data types are only type descriptions. Data types 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.
Data types can be divided into elementary, reference, and complex 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 13 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
date and
time types, namely date fields
(d) and time fields (t). The data types
c, n, x, and p
are generic in terms of length. p is also generic in terms of the number
of decimal places. 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 predefined reference types in ABAP. A reference type must either be defined in the ABAP
program or in the 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 the 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.