Skip to Content
Jan 13, 2014 at 09:16 AM

How to add partner function via USEREXIT_SAVE_DOCUMENT_PREPARE?


Hi Expert,

May i seek for your advice on how to add a new partner function via USEREXIT_SAVE_DOCUMENT_PREPARE without causing any update termination? The requirement is to check if there is no 'RE Bill-to party" maintained in a sales order under header partner function, then the program needs to automatically search the bill-to party via table KNVP that belongs to the sold-to party. Hope you are able to advice me. Thanks in advance.

Steps taken by me.

1. Create a new include program in user exit USEREXIT_SAVE_DOCUMENT_PREPARE.

2. My programming logic is as below:

READ TABLE xvbpa WITH KEY parvw = 'RE'.

lv_kunnr = xvbpa-kunnr.

IF sy-subrc <> 0.

SELECT SINGLE kunn2 parvw Into (lv_kunn2, lv_parvw)

FROM knvp

WHERE kunnr = lv_kunnr

AND vkorg = xvbak-vkorg

AND vtweg = xbvak-vtweg

AND spart = xbvak-spart

AND parvw = 'RE'.

IF sy-subrc = 0.

CLEAR: xvbpa.

xvbpa-parvw = lv_parvw.

xvbpa-kunnr = lv_kunn2.

xvbpa-updkz = 'I'.

APPEND xvbpa.



Blocking point:

1. Whenever I save the sales document, there will be an update termination. I've tried to debug into the update termination, but i cannot understand
what does it mean and i also could not find out why there is an update termination.