ABAP Keyword Documentation → ABAP - Reference → Predefined Types, Data Objects, Functions, and Constructors → 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 category |
c |
Text field with a generic length |
clike |
Character-like (c , d , n , t , string , and character-likeflat 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
- When generic types are used for the typing of
field symbols and
formal parameters,
it must be ensured that the correct results are obtained regardless of the actual type being used. For
example, if
csequence
is used, the potential fixed typesc
andstring
must display different behavior with respect to trailing blanks or the potential numeric types in calculations fornumeric
must produce different calculation types. More specifically, when existing typings are generalized, it may be necessary to modify the implementation accordingly.
- The generic type
any
can, like all generic types listed here except data andobject
, only be specified directly afterTYPE
and has exactly the same effect there as the generic typedata
. AfterTYPE REF TO
, onlydata
(for fully generic data reference variables) andobject
(for fully generic object reference variables) can be specified. SpecifyingREF TO any
would define a fully generic reference variable covering data references and object references. This is not currently possible.
- The generic type
object
can only be specified afterREF TO
and not directly afterTYPE
.
- 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. An object reference variable typed usingREF TO object
can point to any object because of the general reference variable property stating that reference variables with the static type of a superclass can point to objects in all related subclasses. When compared with a data reference variable typed using the real generic data typedata
, which can point to any data object, it is perfectly possible to classifyobject
as a generic type.
- In obsolete
non-Unicode programs,
clike
also coversx
,xstring
, and any flat structures.