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: 

MV45AFZZ

Former Member
0 Kudos
635

Hi all,

Can anyone tell me the difference between USEREXIT_SAVE_DOCUMENT and USEREXIT_SAVE_DOCUMENT_PREPARE in the include MV45AFZZ.

Thanks in advance.

Reshma

1 ACCEPTED SOLUTION

naimesh_patel
Active Contributor
0 Kudos
432

USEREXIT_SAVE_DOCUMENT_PREPARE is being called before system actually saves the document. In the userexit, you can actually change the document content like XVBAK for header, XVBAP for line item etc.

USEREXIT_SAVE_DOCUMENT is being called after the System call the FM RV_SALES_DOCUMENT_ADD to create / RV_SALES_DOCUMENT_UPDATE to modify document. This can be used to update the Z tables which are based on the sales document.

So the flow would be:


USEREXIT_SAVE_DOCUMENT_PREPARE
.
.
.
FM RV_SALES_DOCUMENT_ADD or RV_SALES_DOCUMENT_UPDATE 
.
.
.
USEREXIT_SAVE_DOCUMENT

Regards,

Naimesh Patel

9 REPLIES 9

Former Member
0 Kudos
432

Hi

USEREXIT_SAVE_DOCUMENT_PREPARE is to change the data of sales order before saving it

USEREXIT_SAVE_DOCUMENT is to store some additional data into own Z-table: so here it shouldn't change the data of sales order.

Max

0 Kudos
432

Thanks for your quick reply. So which include gets called first? SAVE one or the PREPARE one?

Thanks

Reshma

0 Kudos
432

Nimesh replied that already above

0 Kudos
432

Hi Reshma,

SAVE_DOCUMENT_PREPARE will trigger first.

Regards

Sravan

0 Kudos
432

Hi

PREPARE and then SAVE

Max

naimesh_patel
Active Contributor
0 Kudos
433

USEREXIT_SAVE_DOCUMENT_PREPARE is being called before system actually saves the document. In the userexit, you can actually change the document content like XVBAK for header, XVBAP for line item etc.

USEREXIT_SAVE_DOCUMENT is being called after the System call the FM RV_SALES_DOCUMENT_ADD to create / RV_SALES_DOCUMENT_UPDATE to modify document. This can be used to update the Z tables which are based on the sales document.

So the flow would be:


USEREXIT_SAVE_DOCUMENT_PREPARE
.
.
.
FM RV_SALES_DOCUMENT_ADD or RV_SALES_DOCUMENT_UPDATE 
.
.
.
USEREXIT_SAVE_DOCUMENT

Regards,

Naimesh Patel

ThomasZloch
Active Contributor
0 Kudos
432

Both routines have an English comment next to them, what's the problem?

Thomas

0 Kudos
432

Thanks for the answer. I thought those were in Latin.

viquar_iqbal
Active Contributor
0 Kudos
432

Information about USEREXIT_SAVE_DOCUMENT_PREPARE

at [this|;