ABAP Keyword Documentation → ABAP − Release-Specific Changes → Changes in Release 6.40
Run Time Type Services in Release 6.40
The Run Time Type Services (RTTS) are a further development of the previously-named Run Time Type Identification (RTTI). With the enhancement of the type classes to methods for dynamic type creation (see modification 1), the RTTS include as of Release 6.40 both the RTTI and also a Run Time Type Creation (RTTC).
1. Methods for creating data types
2. New methods for types from the ABAP Dictionary
3. Enhancement to method GET_COMPONENT_TYPE
4. Enhancement to method GET_PROPERTY
5. New method HAS_PROPERTY
6. New method GET_CLASS_NAME
7. New method GET_DATA_TYPE_KIND
Other versions: 7.31 | 7.40 | 7.54
Modification 1
Methods for creating data types
The type classes of RTTI were enhanced with RTTC methods that create type objects independently of existing types. The previous RTTI becomes the RTTS.
Together with the HANDLE
addition to statements
CREATE DATA
ad ASSIGN
,
the RTTC-specific methods of the RTTS allow the construction of data objects of any types for the program runtime and the
casting of dynamic types.
The most important new methods for the dynamic definition of data types are:
- GET_C, GET_D, GET_F etc. of class CL_ABAP_ELEMDESCR for the creation of type objects for elementary data types.
- CREATE of class CL_ABAP_STRUCTDESCR for the creation of type objects for structured data types based on a component table.
- CREATE of class CL_ABAP_TABLEDESCR for the creation of type objects for table types, whereas the attributes of the table are transferred to the input parameter.
-
CREATE of classCL_ABAP_REFDESCR for the creation of type objects for reference types, whereas the static type is transferred to an input parameter.
Modification 2
New methods for types from the ABAP Dictionary
If the type from the type object comes from the ABAP Dictionary, you can determine the dictionary attributes of the type using the following methods:
for any data types
-
CL_ABAP_TYPEDESCR=>IS_DDIC_TYPE
delivers ABAP_TRUE when the object describes a type from the ABAP Dictionary -
CL_ABAP_TYPEDESCR=>ABSOLUTE_NAME
delivers the absolute name of a type (also for program-defined types) -
CL_ABAP_TYPEDESCR=>GET_DDIC_HEADER
delivers the NameTab header of a type from the ABAP Dictionary -
CL_ABAP_TYPEDESCR=>GET_DDIC_OBJECT
delivers the runtime object of a type from the ABAP Dictionary
for elementary data types
-
CL_ABAP_ELEMDESCR=>GET_DDIC_FIELD
delivers the attributes of the data element and its texts (replaces function module DDIF_FIELDINFO_GET) -
CL_ABAP_ELEMDESCR=>GET_DDIC_FIXED_VALUES
delivers the fixed values of the data element
for structures and database tables
-
CL_ABAP_STRUCTDESCR=>GET_DDIC_FIELD_LIST
delivers the features of the structure and its texts (replaces function module DDIF_FIELDINFO_GET)
Modification 3
Enhancement to method GET_COMPONENT_TYPE
Previously, the method GET_COMPONENT_TYPE of class CL_ABAP_STRUCTDESCR for parameter P_NAME only accepted
actual parameters of types string
and c
. Although
the formal parameter is type any
, during the call, a type check was executed
that caused a serious error for non-text-like actual parameters. Actual parameters of type csequence
and numeric
are now accepted. A text-like parameter is interpreted as a component
name, a numeric parameter as the position of the component in the structure. An actual parameter that
does not apply to csequence
or numeric
triggers the non-class-based exception UNSUPPORTED_INPUT_TYPE.
Modification 4
Enhancement to method GET_PROPERTY
A new public constant CL_ABAP_TYPEDESCR=>TYPEPROPKIND_HASCLIENT has been introduced. If this constant of method GET_PROPERTY is transferred to class CL_ABAP_TYPEDESCR, the system checks whether the type of type object has a client field. A reference to a data object of type ABAP_BOOL is always returned. If the type has a client field, the referenced data object has the value of the constant ABAP_TRUE. If the type does not have a client field or if it does not affect a structure, the referenced data object has the value of the constant ABAP_FALSE .
Modification 5
New method HAS_PROPERTY
A new public method HAS_PROPERTY has been introduced in class CL_ABAP_TYPEDESCR. Unlike GET_PROPERTY, this method only determines whether a type has a property and only returns the values from ABAP_TRUE or ABAP_FALSE.
Modification 6
New method GET_CLASS_NAME
A new public method GET_CLASS_NAME has been introduced in class CL_ABAP_CLASSDESCR. This method returns the name of the class of an object.
Modification 7
New method GET_DATA_TYPE_KIND
A new public method GET_DATA_TYPE_KIND has been introduced in class CL_ABAP_DATADESCR. This method returns
the same values as statement DESCRIBE
FIELD with addition TYPE
. These values are also defined as constants with the prefixe TYPE_KIND_ of class CL_ABAP_DATADESCR.