07-06-2009 10:32 AM
Hi ,
I want to read the column/field names of an internal table into another internal table.
How can this be done?
Kind Regards,
hgarsht Rungta
07-06-2009 10:41 AM
Hi,
W hat is your requirement ? can you please be speific what you want.
Regards,
Nagaraj
07-06-2009 10:43 AM
07-06-2009 10:45 AM
Hi,
I want to read the field names of an internal table.
eg.
for itab_mara i want to read its field names as matnr ersda etc.
Regards,
Harshit Rungta
07-06-2009 10:50 AM
Hi,
u can read like this
itab_mara-matnr.
itab_matnr-ersda.
loop at itab_matnr.
write 😕 itab_matnr-matnr, itab_matnr-ersda.
or if u want to transfer
move :itab_matnr-matnr to itab1_matnr-matnr.
endloop.
Regards,
Nagaraj
07-06-2009 10:55 AM
Hi harshit,
Kindly check...
field-symbols: <column> type any.
data: w_name type string.
loop at itab.
do.
assign component sy-index of structure itab to <column>.
if sy-subrc = 0.
// getting the fieldname in w_name
w_name = <column>.
else.
exit.
endif.
enddo.
endloop.
Regards,
Mdi.Deeba
07-06-2009 11:48 AM
Hi ,
you can get the attributes of any internal table into another ..
check the following code ..
DATA : it_mara TYPE STANDARD TABLE OF mara WITH HEADER LINE.
DATA : it_detail TYPE abap_compdescr_tab,
wa_comp TYPE abap_compdescr.
DATA : ref_descr TYPE REF TO cl_abap_structdescr.
ref_descr ?= cl_abap_typedescr=>describe_by_data( it_mara ).
it_detail[] = ref_descr->components .
loop at it_detail into wa_comp.
write:/ wa_comp-name .
endloop.
Regards,
Rajesh Kumar