USEREXIT_CHECK_VBAP overwriting user values

Development (ABAP Development WorkBench, ABAP/4 programming)

Moderators: Snowy, thx4allthefish, YuriT, Gothmog

Post Reply
Marlboro
Posts: 198
Joined: Fri Dec 27, 2002 8:56 am
Location: Europe

USEREXIT_CHECK_VBAP overwriting user values

Post by Marlboro » Sun Feb 19, 2012 3:58 pm

I am writing a bit of code that will overwrite the payment terms in a sales order item based on a number of factors. (ship-to, incoterms, document type, etc)

I am using the following program MV45AFZB at Exit : USEREXIT_CHECK_VBAP. I am using this exit as the users need to see the payment terms after an item has been entered into the sales order and not have the value determined at sales order save.

I am not using USEREXIT_MOVE_FIELD_TO_VBAP as it is only triggered once at the time of creation and not when I change the document. I need it in USEREXIT_CHECK_VBAP as users could change the incoterms in VA02, so the code must be redetermined.

My code is working as expected, however, I have a problem when a user enters a sales order item line and then manually changes the payment terms, as my code then is over writes the users values.

The flow is as follows
As user creates a sales order
They populate the sales order header
They populate material number and qty
User exit USEREXIT_CHECK_VBAP is triggered and correctly determines the payment terms
The user then double clicks on the sales order item and decides to overwrite the payment terms.
My user-exit is retriggered and check to see if XVBAP-UPDKZ = I (insert)
As it is still an insert, my code triggers.

I have tried to check YVBAP, but no entry exist as it stills is seen as in insert? What I really need to know that while it is still an insert, the user has change the field value and my code should not over write the users value.

Gothmog
Posts: 1955
Joined: Wed Sep 12, 2007 4:46 am
Location: Probably not home

Re: USEREXIT_CHECK_VBAP overwriting user values

Post by Gothmog » Mon Feb 20, 2012 4:33 am

Isn't there an indicator that you could check for conditions entered manually (KOMV-KMANU)?
68 74 74 70 3a 2f 2f 74 69 6e 79 75 72 6c 2e 63 6f 6d 2f 62 64 6f 37 6d 77 67

Marlboro
Posts: 198
Joined: Fri Dec 27, 2002 8:56 am
Location: Europe

Re: USEREXIT_CHECK_VBAP overwriting user values

Post by Marlboro » Mon Feb 20, 2012 5:36 am

Hello,

For us the payment terms is determined from the customer master, and not via the pricing procedure. Thus KOMV-KMANU would not work as it only tracks when a condition is changed and not a field in the SO.

Post Reply