RTTS (RunTime Type Services) allows to get the definition of variables or to create them during program execution. RTTS is made of 2 components:
- RTTI (RunTime Type Identification) is used to get the definition of existing variables or existing types
- RTTC (RunTime Type Creation) is used to create new variables with any definition; they must be followed by the ABAP statement CREATE DATA ... TYPE HANDLE ... to create the variable.
RTTI and RTTC may be called using methods in CL_ABAP_*DESCR classes. Each class have both RTTI and RTTC methods.
Class |
RTTI methods |
RTTC methods |
Attributes |
Comments |
---|---|---|---|---|
CL_ABAP_TYPEDESCR | | | | | |
|
describe_by_data |
absolute_name |
describe_by_name allows to get the definition of a DDIC object. |
|‑‑CL_ABAP_DATADESCR | | | | | | | | | | |
|
|
is_instantiatable |
|
| |‑‑CL_ABAP_ELEMDESCR | | | | | | | | | | | | | | | | | | | | | | |
|
get_n |
edit_mask |
|
| |‑‑CL_ABAP_REFDESCR | | | | | | |
get_referenced_type |
create |
|
Corresponds to variables "type ref to data" and objects "type ref to object" |
| |‑‑CL_ABAP_COMPLEXDESCR |
|
|
|
|
| |‑‑CL_ABAP_STRUCTDESCR | | | | | | |
get_components |
create |
struct_kind |
|
| |‑‑CL_ABAP_TABLEDESCR | | | | | |
get_table_line_type |
create |
key |
|
|‑‑CL_ABAP_OBJECTDESCR | | | | | |
|
|
interfaces |
|
|‑‑CL_ABAP_CLASSDESCR | | | | |
get_super_class_type |
|
class_kind |
|
|‑‑CL_ABAP_INTFDESCR |
get_interface_type |
|
intf_kind |
|
SAP Training : ABAP351
Links
Wikis with RTTI, RTTS or RTTC label
Details:
- Creating Flat and Complex Internal Tables Dynamically using RTTI: code which creates dynamically an internal table whose structure is the one of on an existing variable
3 Comments
Former Member
Hi,
I have one question, if I have an internal table in my program, which table name is stored in a variable (for example lv_tabname which is a string) how can I describe the table?
Unfortunately
Is not working..(syntax error)
Do you have any idea how to solve this?
Thanks in advance!
Former Member
Hi.
Try tis syntax.
DESCRIBE TABLE 'ITAB' LINES lines.
Where 'ITAB' is a table that you want to describe and lines is variable where you will find number of lines this table.
BalReddy Allam
why we use this RTTS ? in which pupose we will use this concept?