‎2007 Jan 31 7:04 PM
Hi All,
I have requirment to merge 2 dynamic internal tables.
This is the scnerio. Here i_key internal table contains the key fields of itab1 and itab2. I have loop thru itab1 and find the field value of fld5 from itab2 and fill in itab1-fld5.
i_key (Internal Table)
field key
fld1 X
fld2 X
itab1
fld1 fld2 fld3 fld4 fld5
A A 1 2
B B 1 3
itab2
fld1 fld2 fld5
A A 4
B B 4
after the looping itab1 look like:-->
itab1
fld1 fld2 fld3 fld4 fld5
A A 1 2 4
B B 1 3 4
My problem is Here itab1 and itab2 are dynamic internal table, so the fields may change.
‎2007 Jan 31 7:15 PM
Hi,
Use ASSIGN COMPONENT ...
Example
-
field-symbols: <fs>.
data: begin of s_mara ,
matnr type matnr,
end of s_mara.
ASSIGN COMPONENT 'MATNR' of structure s_mara to <FS>.
<fs> = 'Test'.
write: / s_mara-matnr.
Thanks,
Naren