Professional Documents
Culture Documents
type
referring
to
the
DATA:
lref_rowtype TYPE REF TO cl_abap_structdescr, "Structure
lref_tabtype TYPE REF TO cl_abap_tabledescr. "Internal Table
?= cl_abap_typedescr=>describe_by_name( 'MAKT' ).
b. If you dont have that, you can create the component table
first; and then you can use that component table as an
input parameter for the method CREATE of the class
CL_ABAP_STRUCTDESCR to get the Line type reference in
lref_rowtype.
** Prepare the Component Table
DATA:
wa_comp TYPE abap_componentdescr,
lt_comp TYPE abap_component_tab.
wa_comp-name = 'MATNR'.
wa_comp-type ?= cl_abap_elemdescr=>describe_by_name( 'MATNR' ).
wa_comp-name = 'MAKTX'.
wa_comp-type ?= cl_abap_elemdescr=>describe_by_name( 'MAKTX' ).
APPEND wa_comp TO lt_comp.
CLEAR wa_comp.
** Get the line type
lref_rowtype = cl_abap_structdescr=>create( p_components = lt_comp ).
4. The CREATE DATA allows creating object during run time and
HANDLE addition is used as the reference is also created
dynamically during runtime.
DATA:
lref_ditab
TYPE REF TO data,
lref_new_line TYPE REF TO data.
CREATE DATA: lref_ditab
TYPE HANDLE lref_tabtype,
lref_new_line TYPE HANDLE lref_rowtype.
ASSIGN lref_ditab->*
TO <fs_dyn_tabl>.
ASSIGN lref_new_line->* TO <fs_dyn_wa>.
Example:
Here is an example Enter any table name in the Selection
screen and the Program will display all the field values of that table.
1. Attached is a sample code that can be used as a ready reference
to test this example.
Sample Programfor
RTTC