Skip to content

ABAP Keyword Documentation →  ABAP - Reference →  Predefined types, data objects, and functions →  Predefined Data Types 

Generic ABAP Types

The following table shows the predefined generic ABAP types. A generic data type is an incomplete type specification that includes multiple complete type specifications. With the exception of object, all generic types can be used after TYPE for the typing of field symbols and formal parameters. When a data object is assigned to generically typed field symbols using the statement ASSIGN, or to a formal parameter in procedure calls, the system checks whether its concrete data type is compatible with it, that is whether it is a subset of the generic type.

The only generic types that can be used after TYPE REF TO are data, for the generic typing of data references, and object for the generic typing of object references.

Type Description
any Any data type
any table Internal table with any table type
c Text field with a generic length
clike Character-like (c, d, n, t, string, and character-likeflat structures); in non-Unicode programs also x, xstring, and any flat structures
csequence Text-like (c, string)
data Any data type
decfloat Decimal floating point number (decfloat16, decfloat34)
hashed table Hashed table
index table Index table
n Numeric text with generic length
numeric Numeric (i (b, s),p, decfloat16, decfloat34, f)
object Any object type (root class of the inheritance hierarchy)
p Packed number with generic length and generic number of decimal places
simple Elementary data type including structured types with exclusively character-like flat components
sorted table Sorted table
standard table Standard table
table Standard table
x Byte field with generic length
xsequence Byte-like (x, xstring)

Besides the predefined generic types shown in the table above, ABAP at present includes exactly one kind of self-defined generic type: A table type defined with TYPES - TABLE OF or defined in ABAP Dictionary is generic if the primary table key is not defined or is incompletely defined and if the secondary table key of the table type is generic.

Other versions: 7.31 | 7.40 | 7.54


Notes

  • The generic type any can, like all generic types listed here except data and object, only be specified directly after TYPE and has exactly the same effect there as the generic type data. After TYPE REF TO, only data (for completely generic data reference variables) and object (for completely generic object reference variables) can be specified. Specifying REF TO any would define a completely generic reference variable covering data references and object references. This is not currently possible.

  • The generic type object can only be specified after REF TO and not directly after TYPE.

  • The object type object plays a special role, because strictly speaking it is not a genuine generic type but the empty root class of all object classes of ABAP Objects. On the one hand, an object reference variable typed with REF TO object behaves like a data reference variable typed with REF TO data by being able to point to any objects. On the other hand, however, this is based only the general attribute of reference variables that they can point from the static type of a superclass to objects of the respective subclass.