Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

User Exit when sales order is saved

former_member295881
Contributor
0 Likes
8,159

Hello Experts,


I've a requirement where I need to make changes to VBAP fields (KWMENG and ABGRU) and VBAK fields (FAKSK and NETWR) when a sales order is saved. I've done some research and found that the following user exit get's call when SAP saves a sales order.

MV45AFZZ

USEREXIT_MOVE_FIELD_TO_VBAK

USEREXIT_MOVE_FIELD_TO_VBAP

Now I'm not sure which table/structures in the above forms I can use to make the required change that will reflect when order has been saved. Can somebody please make any suggestion?

Many thanks in advance.

Hello Experts,


I've a requirement where I need to make changes to VBAP fields (KWMENG and ABGRU) and VBAK fields (FAKSK and NETWR) when a sales order is saved. I've done some research and found that the following user exit get's call when SAP saves a sales order.

MV45AFZZ

USEREXIT_MOVE_FIELD_TO_VBAK

USEREXIT_MOVE_FIELD_TO_VBAP

Now I'm not sure which table/structures in the above forms I can use to make the required change that will reflect when order has been saved. Can somebody please make any suggestion?

Many thanks in advance.

6 REPLIES 6
Read only

Former Member
0 Likes
5,780

Hi

Those exit are always called, in generally they should be used to move data to custom fields, of course you can try to fill the standard one, but you make sure the value is not replaced in the next step of the program.

Here you need to fill VBAK and VBAP

The user-exit calls before saving the Sales Order is USEREXIT_SAVE_DOCUMENT_PREPARE, here you need to fill VBAK for header data and internal table XVBAP for items data

Max

Read only

FredericGirod
Active Contributor
0 Likes
5,780

Hi Zero,

go in debug and test it ..

VBAK

VBAP

XVBPA

XVBFA

..

regards

Fred

Read only

atul_mohanty
Active Contributor
0 Likes
5,780

Hi - Use 'Use USEREXIT_SAVE_DOCUMENT_PREPARE' if you want change before save.

Let us know, in case any further help.

Regards,

Atul Mohanty

Read only

0 Likes
5,780

Many thanks guys for all of your valuable input but I'm not sure why debug does stop at USEREXIT_SAVE_DOCUMENT_PREPARE so that I can make changes. Actually we're making change in the orders by using BAPI_SALESORDER_CHANGE. Therefore, I'm wondering will USEREXIT_SAVE_DOCUMENT_PREPARE still be triggered and changes can be made?

Many thanks in advance.

Read only

0 Likes
5,780

Hi

II'm sure the exit USEREXIT_SAVE_DOCUMENT_PREPARE is triggered as soon as the sales order is saved (for the changing too).

It's usually the best place where it can change the data before the saving, but here you have the whole document.

Max

Read only

Former Member
0 Likes
5,780

This message was moderated.