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 tables

Former Member
0 Likes
733

Hello All,

I want to combine two internal tables,

First one is,

Data: it_ltap_vb like LTAP_VB occurs 0 with header line.

Second one is,

Data: Begin of it_picksave occurs 0,

lgnum like ltap-lgnum,

strat like zparapic-strat,

kunnr like likp-kunnr,

adrnr like vbpa-adrnr,

End of it_picksave.

Will you please let me know how to combine these two tables?

Thanks in Advance,

Ranjan

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
693

Hi,

Create Internal table this way,

data : begin of it_tab occurs 0,

lgnum like ltap-lgnum,

strat like zparapic-strat,

kunnr like likp-kunnr,

adrnr like vbpa-adrnr.

include structure LTAP_VB.

data : end of it_itab.

7 REPLIES 7
Read only

Former Member
0 Likes
693

Means, I want to create an internal table with the combination of the above two tables.

Read only

Former Member
0 Likes
693

Hi ,

Do this way:

loop at it_ltap_vb.

read table it_picksave with key lgnum = it_ltap_vb-lgnum.

if sy-subrc = 0.

move-corresponding it_picksave to it_final.

move-corresponding it_ltap_vb to it_final.

append it_final.

endif.

endloop.

Note: it_final must have the fields from it_ltap_vband it_picksave.

Regards,

Ravi

Read only

Former Member
0 Likes
693

DATA: BEGIN OF itab,

struct LIKE ltap_vb,

lgnum LIKE ltap-lgnum,

kunnr LIKE likp-kunnr,

adrnr LIKE vbpa-adrnr,

END OF itab.

sort table it_picksave by lgnum.

Loop at it_ltap_vb into wa_ltap_vb.

read table it_picksave into wa_picksave with key lgnum = wa_ltap_vb-lgnum.

if sy-subrc = 0.

*use move corresponding to move data.

*append into final table

endif.

Endloop.

I hope it helps.

Best Regards,

Vibha

*Please mark all the helpful answers

Read only

Former Member
0 Likes
693

Hi,

Create a Internal table with all the fields which you want in the final internal table ..

loop at it_ltap_vb.
read table it_picksave with key lgnum = it_ltap_vb-lgnum.
if sy-subrc = 0.
Move : it_ltap_vb-field1 TO newitab-field1
           it_ltap_vb-field2 TO newitab-field2.
           it_picksave-field1 to newitab-field3
           --- --- --
           --- --- --
append newtab.
endif.
endloop.

Regards

Sudheer

Read only

Former Member
0 Likes
693

Hi,

U combine in this way,

data : begin of it_bb occurs 0,

fieldname like tablename-fieldname.

include structure vbap.

data: end of it_bb.

thanks

Read only

0 Likes
693

In ltap_vb structure there are many fields. I want to include this structure instead of keeping all the fields in the third internal table.

Please let me know how to add all the fields of both internal tables and I needs to create new internal table.

Read only

Former Member
0 Likes
694

Hi,

Create Internal table this way,

data : begin of it_tab occurs 0,

lgnum like ltap-lgnum,

strat like zparapic-strat,

kunnr like likp-kunnr,

adrnr like vbpa-adrnr.

include structure LTAP_VB.

data : end of it_itab.