2012 Jun 07 7:22 AM
Hi gurus
i am basically sd consultant , i have one requirement when you take return order with reference to invoice , once i create the return order with reference to invoice
invoice 3 line item
1 st -10 quantity
2 nd - 9 quantity
3 rd - 8 quantity
return order create
1 st - 1 quantity
2 nd- 1 quantity
3 rd - 1 quantity
next time create the return order with same invoice , in that time the previous order quantity minus invoice quantity
1 st = 10-1 =9
2nd = 9-1 = 8
3 rd = 8-1 = 7
this quantity comes at second order quantity , how this capture
i tried to change routine a t copy control
DATA : w_kwmeng TYPE vbap-kwmeng,
w_ntgew TYPE vbap-ntgew,
w_brgew TYPE vbap-brgew,
bal_kwmeng TYPE vbap-kwmeng.
SELECT SUM( kwmeng ) SUM( ntgew ) SUM( brgew ) FROM vbap INTO (w_kwmeng , w_ntgew , w_brgew)
WHERE vgbel = cvbrp-vbeln AND vgpos = cvbrp-posnr.
IF sy-subrc EQ 0.
IF NOT w_kwmeng IS INITIAL.
* cvbrp-fkimg = vbrp-fkimg - w_kwmeng.
bal_kwmeng = cvbrp-fkimg - w_kwmeng.
cvbrp-fkimg = bal_kwmeng.
cvbrp-ntgew = cvbrp-fkimg.
cvbrp-brgew = cvbrp-fkimg.
but system gives below quantity
1 st = 8
2 nd = 7
2 nd = 6
but i want sale order quantity like 9, 8, 7
please help me ,
2012 Jun 07 7:27 AM
Hi
Add
CLEAR: w_kwmeng , w_ntgew , w_brgew.
before select query.
Regards
2012 Jun 07 12:23 PM
2012 Jun 07 12:28 PM
2012 Jun 07 12:30 PM
hi
it is not resolved , same issue will come, check screen
but net weight and gross weight will come fine like below screen
CLEAR: w_kwmeng , w_ntgew , w_brgew.
SELECT SUM( kwmeng ) SUM( ntgew ) SUM( brgew ) FROM vbap INTO (w_kwmeng , w_ntgew , w_brgew)
WHERE vgbel = vbrp-vbeln AND vgpos = vbrp-posnr.
IF sy-subrc EQ 0.
IF NOT w_kwmeng IS INITIAL.
cvbrp-fkimg = cvbrp-fkimg - w_kwmeng.( here i missing some thing , this deduction it some come wrong )
cvbrp-ntgew = cvbrp-fkimg.
cvbrp-brgew = cvbrp-fkimg
can guide me
.
2012 Jun 07 12:59 PM
2012 Jun 07 1:04 PM
Hi Siva,
Your query is on VBAP where only key fields are VBELN and POSNR.
So you can remove SUM aggregate function.
Re-phrase selection query as:
CLEAR: W_KWMENG , W_NTGEW , W_BRGEW.
SELECT KWMENG
NTGEW
BRGEW
FROM VBAP INTO (W_KWMENG , W_NTGEW , W_BRGEW)
WHERE VGBEL = VBRP-VBELN
AND VGPOS = VBRP-POSNR.
IF SY-SUBRC EQ 0.
IF NOT W_KWMENG IS INITIAL.
CVBRP-FKIMG = CVBRP-FKIMG - W_KWMENG.
CVBRP-NTGEW = CVBRP-FKIMG.
CVBRP-BRGEW = CVBRP-FKIMG
Regards,
ManuB
2012 Jun 07 1:28 PM
hi
i check same but its come same no changes ,
when i remove for C
CVBRP-FKIMG = VBRP-FKIMG - W_KWMENG
when this activate system last line item qunatity for all like below screen
here 4 line qnatity 6 , this copy to all line item , this is my problem.
can help this