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

Combining two internal table

Former Member
0 Likes
925

Hi,

Can any one tell how to combine two internal tables??

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
893

Hi Praveen,

use this,

appending lines of itab to itab1.

if both the internal structure are in same structure then this will help u .

else.

use

loop at itab.

move-corresponding fields of itab to itab1.

append itab1.

clear itab1.

.....endloop.

Regards,

ashok

7 REPLIES 7
Read only

Former Member
0 Likes
893
sort i_mpos by warpl.
sort i_mhis by warpl.
sort  i_plwp by plnnr.
sort i_plpo  by plnnr.
 
 loop at i_mpos.
   move-corresponding  i_mpos to it_final.
   read table i_mhis with key warpl eq i_mpos-warpl binary search.
    if sy-subrc eq 0.
        move-corresponding i_mhis to it_final.
    endif.
   read table i_plwp with key plnnr eq i_mpos-plnnr binary search.
    if sy-subrc eq 0.
        move-corresponding i_plwp to it_final.
    endif.
   read table i_plpo with key plnnr eq i_mpos-plnnr binary search.
    if sy-subrc eq 0.
        move-corresponding i_plpo to it_final.
    endif.
 
  append it_final.
  clear it_final.
 
endloop.
Read only

Former Member
0 Likes
893

is there any chance with out using move statement???

Read only

Former Member
0 Likes
893

Sort itab_vbap by vbeln posnr.

sort itab_vbkd by vbeln posnr.

Loop at itab_vbap into wa_vbap.

read table itab_vbkd into wa_vbkd with key vbeln = wa_vbap-vbeln posnr = wa_vbap-posnr binary search.

if sy-subrc = 0.

move corresponding wa_vbap to wa_final.

move corresponding wa_vbkd to wa_final.

append wa_final to itab_final.

endif.

endloop.

For move corresponding statement the name of the fields should match in both the work areas.

Read only

Former Member
0 Likes
894

Hi Praveen,

use this,

appending lines of itab to itab1.

if both the internal structure are in same structure then this will help u .

else.

use

loop at itab.

move-corresponding fields of itab to itab1.

append itab1.

clear itab1.

.....endloop.

Regards,

ashok

Read only

Former Member
0 Likes
893

hi ..

You can loop on one table and read the second table inside the loop .

LOOP at i_tab1 into wa_tab1.

wa_tab3-field1 = wa_tab1-field1.

wa_tab3-field2 = wa_tab1-filed2.

READ TABLE i_tab2 into wa_tab2 WITH KEY vbeln = wa_tab1-vbeln.

wa_tab3-field3 = wa_tab2-field4.

watab4-field5 = wa_tab2-filed6 .

ENDLOOP.

Reward if helpful.

Read only

Former Member
0 Likes
893

hi,

data it_tab like table of wa_struct.

data it_tab2 like table of wa_struct.

it_tab-field1 = "a".

append it_tab.

it_tab2-field2 = "b".

append it_tab2.

move-correponding it_tab to it_tab2.

or

data it_tab3 like table of wa_struct.

loop at it_tab.

it_tab3-field = it_tab -field.

append it_tab3.

endloop.

loop at it_tab2.

it_tab3-field = it_tab2-field.

append it_tab3.

endloop.

regards,

Siva

REGARDS,

Siva.