Code: Alles auswählen.
CALL METHOD cl_abap_structdescr=>describe_by_name
EXPORTING
p_name = va_string
receiving
p_descr_ref = rf_des
EXCEPTIONS
type_not_found = 1
others = 2
Code: Alles auswählen.
data rf_des2 type ref to cl_abap_structdescr.
rf_des2 ?= cl_abap_typedescr=>describe_by_name( va_string ).
Code: Alles auswählen.
TRY.
rf_des2 ?= cl_abap_typedescr=>describe_by_name( va_string ).
CATCH cx_sy_move_cast_error.
ENDTRY.
Code: Alles auswählen.
WHILE sy-subrc = 0.
ASSIGN COMPONENT sy-index OF STRUCTURE bseg TO <fs>.
* mach was mit <fs>
ENDWHILE
Code: Alles auswählen.
data: LR_DES type ref to CL_ABAP_STRUCTDESCR.
data: HR_DES type ref to CL_ABAP_TYPEDESCR.
field-symbols: <LT_COMPONENTS> type ABAP_COMPDESCR.
call method CL_ABAP_TYPEDESCR=>DESCRIBE_BY_NAME
exporting
P_NAME = 'BSEG'
receiving
P_DESCR_REF = HR_DES
exceptions
others = 2.
if not HR_DES is initial.
LR_DES ?= HR_DES.
loop at LR_DES->COMPONENTS assigning <LT_COMPONENTS>.
* mach was mit <lt_components>
* Anzahl Stellen, Variablentype etc.
endloop.
endif.
Code: Alles auswählen.
lr_des ?= hr_des.