‎2007 Oct 29 3:51 AM
Hi experts,
I have some data in one internal table say itab.
Ex: in itab i am having ebeln and ihrez fields data from EKKO.
And in another internal table jtab i am having ebeln,ebelp,werks data from ekpo.
now i want to move ebeln,ihrez,werks into another internal table to ktab.
What is the efficient way for doing it.The ebeln from ekko may have mutiple items in ekpo.
Regards
‎2007 Oct 29 4:13 AM
Hi,
Try this
itab -->ebeln ihrez.
Jtab --> ebeln,ebelp,werks
Ktab --> ebeln, ihrez,werks
Loop at itab.
Loop at jtab where ebeln = itab-ebeln.
Move itab-ebeln to ktab-ebeln.
Move itab-iherz to ktab-ihrez.
Move jtab-werks to ktab-werks.
Append ktab.
Endloop.
endloop.
Regards,
Ruthra
Message was edited by:
Sundaresan
Message was edited by:
Sundaresan
‎2007 Oct 29 4:01 AM
Hi
U can use join and move the values to another internal table.
Thanks
Vasudha
‎2007 Oct 29 4:06 AM
itab ->ebeln and ihrez
jtab->ebeln,ebelp,werks
define one extra field in jitab with ihrez
Loop at jitab.
Read table itab with key ebeln = jitab-ebeln.
if sy-subrc = 0.
move itab-ihrez to jitab-ihrez.
modify jitab.
endif.
endloop.
now you will get all in jitab no need to go for new table
If still you want to go for kitab then check below
Loop at jitab.
move jitab-ebeln to kitab-ebeln
move jitab-werks to kitab-werks.
Read table itab with key ebeln = jitab-ebeln.
if sy-subrc = 0.
move itab-ihrez to kitab-ihrez.
endif.
Append kitab.
endloop.
you will get all data in kitab
Rewards if useful...........
Minal Nampalliwar
‎2007 Oct 29 4:10 AM
you can do it many ways.....
for ex:
DATA:wk_ihrez type EKKO-ihrez.
sort jtab by ebeln ascending.
LOOp at jtab.
at new ebeln.
read table itab into wa_itab with key ebeln = jtab-ebeln binary search.
if sy-subrc = 0.
wk_ihrez = wa_itab-ihrez.
clear wa_itab.
endif.
endat.
move:wk_ihrez to ktab-ihrez.
move corresponding jtab to ktab.
append ktab.
endloop.
‎2007 Oct 29 4:19 AM
‎2007 Oct 29 4:13 AM
Hi,
Try this
itab -->ebeln ihrez.
Jtab --> ebeln,ebelp,werks
Ktab --> ebeln, ihrez,werks
Loop at itab.
Loop at jtab where ebeln = itab-ebeln.
Move itab-ebeln to ktab-ebeln.
Move itab-iherz to ktab-ihrez.
Move jtab-werks to ktab-werks.
Append ktab.
Endloop.
endloop.
Regards,
Ruthra
Message was edited by:
Sundaresan
Message was edited by:
Sundaresan