Application Development 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: 

difference between USEREXIT_SAVE_DOCUMENT or USEREXIT_SAVE_DOCUMENT_PREPARE

Former Member
0 Kudos

what is the difference between USEREXIT_SAVE_DOCUMENT or USEREXIT_SAVE_DOCUMENT_PREPARE

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi Mike,

Both are same both few things which needs to be changed between the two userexit

USEREXIT_SAVE_DOCUMENT_PREPARE . : If you want to make the validation you use this userexti and this is the last time to do the changes.

USEREXIT_SAVE_DOCUMENT : If you want ot modify the code then you can use it for this userexit.

8 REPLIES 8

Former Member
0 Kudos

Hello Mike,

The exit USEREXIT_SAVE_DOCUMENT is used to change the SO when saving it.

USEREXIT_SAVE_DOCUMENT_PREPARE

U get the data which are all changes during saving.

If useful reward.

Vasanth

Former Member
0 Kudos

Hi,

- USEREXIT_SAVE_DOCUMENT_PREPARE: it's triggered before saving document,

- USEREXIT_SAVE_DOCUMENT: it's triggered while saving document.

If you need to store your data in Z-TABLE, yous should use the userexit USEREXIT_SAVE_DOCUMENT instead of USEREXIT_SAVE_DOCUMENT_PREPARE:

Here you have to insert all abap code you need to update your z-table.

U should consider all saving are made in update tusk, so it should be better you create a z-function to update your z-table and call that fm in update tusk into USEREXIT_SAVE_DOCUMENT.

Former Member
0 Kudos

USEREXIT_SAVE_DOCUMENT is used to change the Sales Order while saving data.

USEREXIT_SAVE_DOCUMENT_PREPARE is used to get the changes done during saving.

Former Member
0 Kudos

The main difference is that in USEREXIT_SAVE_DOCUMENT_PREPARE you can change data in x* internal tables and these changes will be passed to DB, while in USEREXIT_SAVE_DOCUMENT - it's too late to change data in SAP internal tables (x* tables) since SAP has already passed these tables to update task FM... save_document can be used for triggering your own table (Z* table) updates, for triggering workflow events, for final validation of order info and raising error message to prevent order save.

0 Kudos

Thank you!! I could'nt find the right user exit and after your post...it is working!!!

Former Member
0 Kudos

Hi,

Check the sap help ..

USEREXIT_SAVE_DOCUMENT

Use this user exit to fill user-specific statistics update tables.

The user exit is called up by the FORM routine BELEG-SICHERN before

the COMMIT command.

Note

If a standard field is changed, the field r185d-dataloss is set to

X. The system queries this indicator at the beginning of the safety

routine. This is why this indicator must also be set during the

maintenance of user-specific tables that are also to be saved.

USEREXIT_SAVE_DOCUMENT_PREPARE

Use this user exit to make certain changes or checks immediately

before saving a document. It is the last possibility for changing or

checking a document before posting.

The user exit is carried out at the beginning of the FORM routine

BELEG_SICHERN.

Thanks,

Naren

Former Member
0 Kudos

Hi Mike,

Both are same both few things which needs to be changed between the two userexit

USEREXIT_SAVE_DOCUMENT_PREPARE . : If you want to make the validation you use this userexti and this is the last time to do the changes.

USEREXIT_SAVE_DOCUMENT : If you want ot modify the code then you can use it for this userexit.

Former Member
0 Kudos

If you really want to see from where can you get the information regarding userexit then

Go to SPRO --> Sales and Distribution --> System Modification --> UserExits --> UserExit in Sales --> UserExit in Sales Document Processing.

Go and check out all the userexit present for Sales will find it in.