Skip to content

ABAP Keyword Documentation →  ABAP - Reference →  Declarative statemnts →  Data Types and Data Objects →  Types and Objects - Overview 

Absolute Type Names

The type name that can be used statically in ABAP statements is relative to its context, and is also known as the relative type name. As described in Validity and Visibility, local data types hide more global data types of the same name. The same applies to classes and interfaces, which can also be interpreted as type definitions in this regard.

Absolute type names, however, name a type uniquely. An absolute type name as a path specifications is composed of the following components:

  • \TYPE=name
  • \CLASS=name
  • \INTERFACE=name
  • \PROGRAM=name
  • \CLASS-POOL=name
  • \FUNCTION-POOL=name
  • \TYPE-POOL=name
  • \METHOD=name
  • \FORM=name
  • \FUNCTION=name

The last component of a path must always be \TYPE=name, \CLASS=name, or \INTERFACE=name. It describes a data type, a class, or an interface. Absolute type names that only consist of \TYPE=name, \CLASS=name, or \INTERFACE=name describe a data type from the ABAP Dictionary or a global class/interface of the class library. To create absolute type names for local data types, classes, and interfaces, use sequential component names that specify its context as prefixes.

Absolute type names can be used in all statements in which dynamic specification of a data type, a class, or an interface is possible. This makes it possible to remove the hiding of a global type by a local type using the specification of an absolute type name, and you can use the absolute type names to dynamically access the types, classes, and interfaces of other programs. It is possible to load a different program into the current internal session if this is necessary for access.

A data type is uniquely identified by its absolute type name. Various options exist, however, for forming an unique path for a type. For example, you can omit the function group for a type in a function module, because every function module is unique. If types are located in a class pool or function group, you can also specify the technical name name of the ABAP program. Since the latter is not known most of the time, we recommend using \CLASS-POOL or \FUNCTION-POOL instead.

A data type that only exists as a property of a data object does not have a relative type name. However, internally it has an absolute type name (technical type name) that uniquely defines the data type.

Other versions: 7.31 | 7.40 | 7.54


Notes

  • The type classes of the Run Time Type Services (RTTS), such as CL_ABAP_TYPEDESCR, contain methods that return the absolute type name of data types or data objects.

Example

When the methods m1 and m2 of the class c1 are called in the following example, the RTTS get the absolute type names \TYPE=SPFLI or \PROGRAM=RTTI_TEST\CLASS=C1\METHOD=M2\TYPE=SPFLI for the generically typed parameter p. The use of the name spfli has different meanings in the methods m1 and m2. A syntax check warning reminds you of this.

CLASS c1 DEFINITION.
  PUBLIC SECTION.
    METHODS: m1,
             m2,
             m3 IMPORTING p TYPE any.
ENDCLASS.
CLASS c1 IMPLEMENTATION.
  METHOD m1.
    DATA struc TYPE spfli.
    m3( struc ).
  ENDMETHOD.
  METHOD m2.
    TYPES spfli TYPE spfli.
    DATA struc TYPE spfli.
    m3( struc ).
  ENDMETHOD.
  METHOD m3.
    DATA type_descr TYPE REF TO cl_abap_typedescr.
    type_descr = cl_abap_typedescr=>describe_by_data( p ).
    WRITE / type_descr->absolute_name.
  ENDMETHOD.
ENDCLASS.