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

Need Help

Former Member
0 Likes
439

I have one internal table Matnr,WERKS, bdzei . ie material, S.org, req pointer.

i have anothoer internal table with bdzei, qty. i want to merge the two internal table into one according to there material no and its qty.

can any one plz help its urgent

point will be sure

Mohana

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
411

Hi Mohana,

declare an internal table it_final with fields Matnr,WERKS, bdzei, qty.

loop at itab1 into wa1.
 wa_final-matnr = wa1-matnr.
 wa_final-werks = wa1-werks.
 wa_final-bezei = wa1-bezei.
 read table itab2 into wa2 with key bezei = wa1-bezei.
 if sy-subrc = 0.
  move wa2-qty to wa_final-qty. 
 endif.
append wa_final to it_final.
clear wa_final.
endloop.

<b>Reward points for helpful answers</b>

Satish

2 REPLIES 2
Read only

Former Member
0 Likes
412

Hi Mohana,

declare an internal table it_final with fields Matnr,WERKS, bdzei, qty.

loop at itab1 into wa1.
 wa_final-matnr = wa1-matnr.
 wa_final-werks = wa1-werks.
 wa_final-bezei = wa1-bezei.
 read table itab2 into wa2 with key bezei = wa1-bezei.
 if sy-subrc = 0.
  move wa2-qty to wa_final-qty. 
 endif.
append wa_final to it_final.
clear wa_final.
endloop.

<b>Reward points for helpful answers</b>

Satish

Read only

Former Member
0 Likes
411

Hi,

Here is sample code -

SORT IT_MATNR BY MATNR.

SORT IT_QTY NY BDZEI.

LOOP AT IT_MATNR.

READ TABLE IT_QTY WITH KEY BDZEI = IT_MATNR-BDZEI.

IF SY-SUBRC EQ 0.

IT_MATNR=QTY = IT_QTY-QTY.

MODIFY IT_MATNR INDEX SY-TABIX TRANSPORTING QTY.

ENDIF.

ENDLOOP.

Hope this helps.

ashish