SAP BUILT IN TYPES GENERIC

Get Example source ABAP code based on a different SAP table
  


ARTICLE
• any ABAP_GENERIC_TYPE
• any table ABAP_GENERIC_TYPE
• c ABAP_GENERIC_TYPE
• clike ABAP_GENERIC_TYPE
• csequence ABAP_GENERIC_TYPE
• data ABAP_GENERIC_TYPE
• decfloat ABAP_GENERIC_TYPE
• hashed table ABAP_GENERIC_TYPE
• index table ABAP_GENERIC_TYPE
• n ABAP_GENERIC_TYPE
• numeric ABAP_GENERIC_TYPE
• object ABAP_GENERIC_TYPE
• p ABAP_GENERIC_TYPE
• simple ABAP_GENERIC_TYPE
• sorted table ABAP_GENERIC_TYPE
• standard table ABAP_GENERIC_TYPE
• table ABAP_GENERIC_TYPE
• x ABAP_GENERIC_TYPE
• xsequence ABAP_GENERIC_TYPE

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. TypeDescription ABAP_KEY anyAny data type ABAP_KEY any tableInternal table with any table type ABAP_KEY cText field with a generic length ABAP_KEY clikeCharacter-like (c, d, n, t, string, and character-like flat structures); in non- Unicode programs also x, xstring, and any flat structures ABAP_KEY csequenceText-like (c, string) ABAP_KEY dataAny data type ABAP_KEY decfloatDecimal floating point number (decfloat16, decfloat34) ABAP_KEY hashed tableHashed table ABAP_KEY index tableIndex table ABAP_KEY nNumeric text with generic length ABAP_KEY numericNumeric (i (b, s),
int8, p, decfloat16, decfloat34, f) ABAP_KEY objectAny object type (root class of the inheritance hierarchy) ABAP_KEY pPacked number with generic length and generic number of decimal places ABAP_KEY simpleElementary data type including structured types with exclusively character-like flat components ABAP_KEY sorted tableSorted table ABAP_KEY standard tableStandard table ABAP_KEY tableStandard table ABAP_KEY xByte field with generic length ABAP_KEY xsequenceByte-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.