SAP NetWeaver AS ABAP Release 740, ©Copyright 2014 SAP AG. All rights reserved.
ABAP Keyword Documentation → ABAP − Release-Specific Changes → Changes in Release 6.40 →
Runtime Type Services in Release 6.40
The runtime type services (RTTS) are a further development of the former runtime type identification
(RTTI). With the enhancement of the
type description classes
to include methods for creating dynamic types (see modification 1), the RTTS include (as of Release 6.40) the RTTI and also runtime type creation
(RTTC).
1. Methods for creating data types
2. New methods for types from ABAP Dictionary
3. Enhancement of method GET_COMPONENT_TYPE
4. Enhancement of method GET_PROPERTY
5. New method HAS_PROPERTY
6. New method GET_CLASS_NAME
7. New method GET_DATA_TYPE_KIND
Methods for creating data types
The type description classes of RTTI were enhanced using RTTC methods. These methods create type description objects independently of existing types. This means what was previously 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 dynamically defining data types are:
New methods for types from ABAP Dictionary
If the type of a type description object comes from ABAP Dictionary, the dictionary attributes of the type can be identified using the following methods:
for any data types
for elementary data types
for structures and database tables
Enhancement of 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.
Enhancement of method GET_PROPERTY
A new public constant CL_ABAP_TYPEDESCR=>TYPEPROPKIND_HASCLIENT has been introduced. If this constant
of method GET_PROPERTY is passed to class CL_ABAP_TYPEDESCR, the system checks whether the type of the
type description 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 .
New method HAS_PROPERTY
A new public method HAS_PROPERTY has been introduced in class CL_ABAP_TYPEDESCR. Unlike GET_PROPERTY,
this method only identifies whether a type has a property and only returns the values from ABAP_TRUE or ABAP_FALSE.
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.
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 prefix TYPE_KIND_ of class CL_ABAP_DATADESCR.