Hi,
In VA02,
Scenario 1-Change a field for an existing record
form userexit_save_document_prepare (MV45AFZZ) -
move XVBAP to YVBAP.
APPEND YVBAP.
XVBAP-UPDKZ = 'U' . ( For the changed line ) .
modify xvbap transporting updkz.
Scenario 2-Insert a new record at the end .
form userexit_save_document_prepare (MV45AFZZ) -
XVBAP-UPDKZ = 'I'.
APPEND the new line in XVBAP.
No need to change it in YVBAP .
Scenario 3 - Delete the record.
XVBAP-UPDKZ = 'D'.
modify xvbap transporting updkz .
move XVBAP to YVAP.
APPEND YVBAP .
Do one thing, comment your code in the userexit.Put the breakpoint in USEREXIT_SAVE_DOCUMENT_PREPARE and also activate update debugging.
See how the standard does it. Check the values of XVBAP[] & YVBAP[] in the userexit. Then press F8, debugger will stop at FM ‘RV_SALES_DOCUMENT_UPDATE’ ( check value of FXVBAP[] & FYVBAP[].
Also, have a look at OSS note 178328 - Problems due to incorrect user exits in SD.
Regards,
DPM