The CL_ABAP_STRUCTDESCR class also has a number of public attributes with basic information, such as the total length in bytes, the existence of includes, the type of structure (nested or not), and so on. The COMPONENTS attribute is an internal table that contains the names of all components and their elementary technical properties. You can use the GET_DDIC_FIELD_LIST method to determine the semantic information (if any) for the components. It is similar to the GET_DDIC_FIELD method, but returns an internal table instead of a structure.
Navigation from Structure Type to Component Types
To gain full access to all properties of the component types, navigate to the respective description objects. The GET_COMPONENT_TYPE navigation method returns the description object for the type of a specific component, while the GET_COMPONENTS navigation method returns the description objects for all components.
Hint: Because component types are also reference types, structure types, or table types, define the return values with type REF TO CL_ABAP_DATADESCR. A downcast to a subclass–typed reference variable may be necessary in reference variables, for example, to type REF TO CL_ABAP_ELEMDESCR.
Table Type Analysis
The public attributes of class CL_ABAP_TABLEDESCR include the table type (for example, standard, sorted, hashed, index, or any) uniqueness of the key, and a list of names of the key components. To determine the details for a line type, navigate to a description object for that line type using the GET_TABLE_LINE_TYPE navigation method.
Hint: The line type of a table type can have any data type. Accordingly, the return parameter is typed with REF TO CL_ABAP_DATADESCR, so you might have to perform a downcast to a suitable type if necessary.
Object Type Analysis
RTTI permits you to analyze the attributes of objects by working with classes CL_ABAP_CLASSDESCR and CL_ABAP_INTFDESCR.
Most of the attributes and methods for these two classes are defined in the (abstract) shared superclass CL_ABAP_OBJECTDESCR because they are required to analyze both classes and interfaces.
A class is analyzed in the example shown in the figure. Most of the information also applies to the analysis of interfaces.
Class CL_ABAP_CLASSDESCR contains public attributes that list the attributes, methods, events, interfaces, and other objects of the described class. These attributes are typed as internal tables. Some of these attributes, such as METHODS, are defined as nested internal tables in which each line itself contains one or more internal tables. For example, these nested internal tables contain lists with parameters and exceptions for the respective method.
In addition to these inherited attributes, class CL_ABAP_CLASSDESCR also provides specific attributes, such as the CLASS_KIND attribute, which you use to determine whether the class was flagged as abstract, final, and so on.
Class CL_ABAP_INTFDESCR contains an INTF_KIND attribute instead, which you use to determine whether an interface is comprised of multiple interfaces.
The figure demonstrates how to use RTTI to determine all the parameters of the constructor for class CL_RENTAL.
After the program generates the description object and performs the downcast, it reads the description of the constructor method from the list of methods (statement with READ TABLE). The program then evaluates the list of parameters for the constructor method in a loop (LOOP over the inner internal table).
The description classes for object types also provide navigation methods for determining the details of a used type. For example, the GET_ATTRIBUTE_TYPE method returns the description object for the type of a specific attribute, while GET_METHOD_PARAMETER_TYPE analyzes the type of a specific method parameter, and so on.
The GET_SUPER_CLASS_TYPE method is specific to classes. It returns the description object for the direct superclass, if any.