‎2009 Aug 31 7:13 PM
Hi ,
I have internal table it_tab contains data . I have one more internal table IT_TAB2 contains the data .
ITAB1 data:-
MATNR MTART EXTRA
12345 HALB
4567 HALB
ITAB2 data:-
MATNR EXTRA
12345 0678909
12345 0678967
here only MATNR is the key field in both internal tables.
loop at it_tab.
loop at it_tab1 where matnr = it_tab-matnr.
it_tab-extra = it_tab1-extra.
modify it_tab.
endloop.
endloop.
it is diplaying like below
12345 HALB 0678967
12345 HALB 0678967
But I want print like below when I use the modify statement .
12345 HALB 0678909
12345 HALB 0678967
Please help me in this .
regards,
Ajay reddy
‎2009 Aug 31 7:20 PM
you goto mention the index where that record need to be updated..
example :
modify itab from wa index sy-tabix.
‎2009 Aug 31 7:20 PM
you goto mention the index where that record need to be updated..
example :
modify itab from wa index sy-tabix.
‎2009 Aug 31 7:20 PM
Hi,
Try like below:
data: lv_tabix like sy-index.
loop at it_tab.
lv-tabix = sy-tabix.
read table it-tab1 with key matnr = it_tab-matnr.
if sy-subrc = 0.
it_tab-extra = it_tab1-extra.
modify it_tab index lv-tabix transporting extra.
endif.
endloop.
Regards,
Himanshu
‎2009 Aug 31 7:34 PM
Hi ,
Still i am getting the same result. any help.
regards,
Ajay
‎2009 Aug 31 7:38 PM
Hi Ajay,
Am still not clear with your question. You have given a sample for itab1 and itab2. What are the contents of itab? Can you explain your requirement?
‎2009 Aug 31 7:42 PM
Try this you dont need modify if you do this:
field-symbols: <fs_tab> type line of tab,
<fs_tab1> type line of tab1.
loop at it_tab assigning <fs_tab>.
loop at it_tab1 assinging <fs_tab1> where matnr = <fs_tab>-matnr.
if sy-subrc eq 0.
<fs_tab>-extra = <fs_tab1>-extra.
endif.
endloop.
endloop.
‎2009 Aug 31 8:34 PM
Hi Vikranth,
I am impoting the values from One Function module.. into both the internal tables.
Just I want update the ITAB1 where the Blank data (EXTRA), need to fill that from ITAB1.
I am trying the options given by our friends....
regards,
Ajay reddy
‎2009 Sep 01 7:22 AM
Hi Ajay,
Based on your first post:
ITAB1 data:-
MATNR MTART EXTRA
12345 HALB
4567 HALB
ITAB2 data:-
MATNR EXTRA
12345 0678909
12345 0678967
You are looking for a result like below:
12345 HALB 0678909
12345 HALB 0678967
Which is not only updating the extra field but updating extra fields for all extra values in itab2 and removing any lines in itab1 where matnr does not have extra.
So if you want result like this you should refer to my second post which will provide you result like that in the third internal table
Regards,
Himanshu
‎2009 Aug 31 7:23 PM
Hi,
sort it_tab by matnr.
sort it_tab1 by matnr.
loop at it_tab into ws_itab.
read table it_tab1 into ws_itab1 with key matnr = it_tab-matnr.
if sy-subrc = 0.
ws_tab-extra = ws_tab1-extra.
modify it_tab from ws_itab transporting extra.
endloop.
Regards,
Subramanian
‎2009 Aug 31 7:23 PM
Hi,
Do as follows:-
loop at it_tab.
READ TABLE it_tab1 into WA1
with key matnr = it_tab-matnr.
if sy-subrc eq 0.
it_tab-extra = wa1-extra.
modify it_tab.
endif.
endloop.Regards,
Ankur Parab
‎2009 Aug 31 7:46 PM
Hi,
try like below:
declare one more internal table like itab lets say itab2.
loop at itab.
loop at itab1 where matnr = itab-matnr.
move-corresponding itab to itab2.
itab2-extra = itab1-extra.
append itab2.
endloop.
endloop.
Regards,
Himanshu