‎2007 Sep 27 4:28 PM
Hi,
What I'd like to do is modify entries of an Internal table, from another another internal table, based on certain field logic.
For example, say my main internal table has two lines and 2 fields.
Fields Name Matnr
Line 1 Jim 1059
Line 2 Bush 2076
So then I loop through a different internal table and if the 2nd internal table has MATNR with value 2076, then change the name field or in a real cause, all of the corresponding fields (I use move-corresponding i_act to itab_data2.)
How do I do this?
Thanks,
Laura
‎2007 Sep 27 4:36 PM
sort itab2 by matnr.
loop at itab1.
read table itab2 with key matnr = itab1-matnr.
l_index = sy-tabix.
if sy-subrc EQ 0.
loop at itab2 from index l_index.
if itab2-matnr EQ itab1-matnr.
<< populate the changed vaues here in itab2 header>>
modify itab2.
else.
exit.
endif
endloop.
endif.
endloop
reward if helpful**
‎2007 Sep 27 4:40 PM
Hi,
Take help from example code as below :
sort itab by matnr.
sort itab1 by matnr.
loop at itab into wa_itab.
read table itab1 into wa_itab1 WITH KEY matnr = wa_itab-matnr BINARY SEARCH.
If sy-subrc eq 0.
move corresponding wa_itab1 to wa_itab.
modify table itab from wa_itab.
endif.
endloop.
Regards,
Sandeep Kaushik
Message was edited by:
Sandeep Kaushik