01-24-2013 9:03 AM
C1,cp2,Y407,5000,10000,20000
C2,cp2,Y407,5000,10000,20000
C1,cp1,Y407,5000,10000,20000'
cst num and cst pt are primary keys and matnr also
result should come y407 15000 30000 60000
Hi
Above is the text file, i need to add qty fields if both c1,c2(cust number) and (cp1, cp2)cust part are not matching in rows.. if it is matching is sholud not sum up.
i tried doing it buut it is giving me sum of y407 10000 20000 40000 instead of y407 15000 30000 60000
below is my code. kindly suggest whats wrong..
REFRESH: itab2.
SORT itab BY matnr .
LOOP AT itab INTO watab.
IF sy-tabix NE 1.
wi_tabix = sy-tabix - 1.
READ TABLE itab INTO watab2 INDEX wi_tabix.
IF watab-wc_cstno <> watab2-wc_cstno
OR watab-wc_cstpt <> watab2-wc_cstpt.
if sy-subrc = 0.
watab-wc_cstno = ''.
watab-wc_cstpt = ''.
endif.
COLLECT watab INTO itab2.
ENDIF.
ENDIF.
ENDLOOP.
01-24-2013 9:33 AM
Moderator message:
Please search form the mentioned information in SAP help , Un-marking this thread as a question due to its basic nature, from next time please try to use a meaningful subject line.
Hint: Move the third field to first field of itab and use a control break statement with first field along with SUM addition.