12-19-2006 5:04 AM
hello,
we have a z table have the key fields customer and material. other field is cumulative quantity.
when ever the sales order is saved or created(va01 and va02) for the combination of particular customer and material then culumative quantity is to be updated in our z table.so that our client can come to know for particular customer and material the total(cumulative) quantity.
regards
alka
12-19-2006 5:05 AM
Hi
Do your coding in FORM SAVE_DOCUMENT in MV45AFZZ.
You would have xvbak and xvbap available in this FORM.
Regards
Deepak
P.S Kindly award points if helpful
Message was edited by:
Deepak Krishnakumar
12-19-2006 5:05 AM
Hi
Do your coding in FORM SAVE_DOCUMENT in MV45AFZZ.
You would have xvbak and xvbap available in this FORM.
Regards
Deepak
P.S Kindly award points if helpful
Message was edited by:
Deepak Krishnakumar
12-19-2006 5:33 AM
Hi,
Form SAVE_DOCUMENT can be used for this purpose.
Go to MV45AFZZ and find the subroutine.
In the documentation part of the Subroutine they will explain that this Form is used to update any ztable while saving the document.
12-19-2006 5:34 AM
Hi Alka ,
Tell me do u want your code to be check when the order is saved or on save i mean the order is generated or not generated.
12-19-2006 6:05 AM
yes dinesh every time it's being saved i.e. while being created or changed
regards
alka
12-19-2006 5:43 AM
hi ,,
whenever u r saving or creating refer to table T180-tcode = 'V' in the user exit MV45AFZZ.
im just showing u some sample code
IF T180-TRTYP = 'V'. "INDICATES SALES
loop at xvbap.
IF xVBAP-ABGRU NE ' ' .
SELECT SINGLE * FROM ZXXXXXXXXXX
WHERE SOLDTO = VBAK-KUNNR "CUSTOMER
IF SY-SUBRC EQ 0.
SELECT SINGLE * FROM MARA WHERE MATNR = XXX-MATNR
.
IF SY-SUBRC EQ 0.
ZXXXXXX-VBELN = XVBAP-VBELN.
ZXXXXXX-POSNR = XVBAP-POSNR.
ZXXXXXX-ERZET = SY-UZEIT.
ZXXXXXX-UNAME = SY-UNAME.
ZXXXXXX-KUNNR = VBAK-KUNNR. "CUSTOMER
ZXXXXXX-MATNR = V_MATNR ."PASS THIS
ZXXXXXX-QUNTY = V_QUNTY . "CUMULATIVE QUANTITY.
INSERT ZXXXXXXX.
ENDIF.
ENDIF.
ENDIF.
endloop.
ENDIF.
total cumylative quantity just sum it up and pass to the ztable.
this is sample code of how to proceed .
regards,
vijay
FOR VA01 T180-TRTYP = 'H'.
VA02 T180-TRTYP = 'V'.
CHECK FOR THE TWO VALUES IN UR CASE.
12-19-2006 9:52 AM