Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

moving data

Former Member
0 Likes
715

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

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
693

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

5 REPLIES 5
Read only

Former Member
0 Likes
693

Hi

U can use join and move the values to another internal table.

Thanks

Vasudha

Read only

Former Member
0 Likes
693

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

Read only

kesavadas_thekkillath
Active Contributor
0 Likes
693

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.

Read only

0 Likes
693

rewards points if usefull

Read only

Former Member
0 Likes
694

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