sapdev logo background
sapdev logo sapdev logo
Comments

SAP BUILT IN TYPES GENERIC documentation, setup help and example usage



Return to SAP documentation index


ARTICLE

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
ABAP_KEY any Any data type
ABAP_KEY any table Internal table with any table type
ABAP_KEY c Text field with a generic length
ABAP_KEY clike Character-like ( c , d , n , t , string , and character-like flat structures ); in non-
Unicode programs also x ,
xstring , and any flat structures
ABAP_KEY csequence Text-like ( c , string )
ABAP_KEY data Any data type
ABAP_KEY decfloat Decimal floating point number ( decfloat16 , decfloat34 )
ABAP_KEY hashed table Hashed table

ABAP_KEY index table Index table
ABAP_KEY n Numeric text with generic length
ABAP_KEY numeric Numeric ( i ( b , s ),
int8 , p , decfloat16 , decfloat34 , f )
ABAP_KEY object Any object type (root class of the inheritance hierarchy)
ABAP_KEY p Packed number with generic length and generic number of decimal places
ABAP_KEY simple Elementary data type including structured types with exclusively character-like flat components
ABAP_KEY sorted table Sorted table

ABAP_KEY standard table Standard table
ABAP_KEY table Standard table
ABAP_KEY x Byte field with generic length
ABAP_KEY 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.

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.
    Documentation extract taken from SAP system, � Copyright SAP AG. All rights reserved




  • BUILT_IN_TYPES_DICTIONARY
    BUSINESS_ADD-IN_GLOSRY




    comments powered by Disqus