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

SD - USEREXIT_SAVE_DOCUMENT

Former Member
0 Likes
1,172

Hi I want to stop a user from saving a sales order and return them to the screen so that that can re-enter the failed data. But when I code in a error message in the USEREXIT_SAVE_DOCUMENT.all the fileds get greyed out. How should I do this?

Hi I want to stop a user from saving a sales order and return them to the screen so that that can re-enter the failed data. But when I code in a error message in the USEREXIT_SAVE_DOCUMENT.all the fileds get greyed out. How should I do this?

5 REPLIES 5
Read only

ramesh_mahankali
Active Participant
0 Likes
948

Hi,

I think you need to write your code in FORM USEREXIT_SAVE_DOCUMENT_PREPARE.

-Ramesh

Read only

0 Likes
948

Hi,

U do not give the error message directly.

using the loop at screen....endloop, between loop u can give the error message.

You can try same thing in exit USEREXIT_SAVE_DOCUMENT_PREPARE , if not usefull than u will try in exit USEREXIT_FIELD_MODIFICATION

Read only

brad_bohn
Active Contributor
0 Likes
948

USEREXIT_SAVE_DOCUMENT is provided only for updating addtional tables, not for validation checks. USEREXIT_SAVE_DOCUMENT_PREPARE is not a very graceful solution either. USEREXIT_FIELD_MODIFICATION, which is a PBO exit for adjusting field displays, is a bad suggestion and won't work at all.

The solution depends on your requirement. Although incompletion procedures do not stop you from saving the document, they do stop any subsequent activities if configured properly. It's better to use them and train your users accordingly. If you must implement an additional check and hard stop before save, then is the requirement such that it can be implemented at the time the header or line item info is entered, or does the requirement indicate that all items be entered before the checks are performed? If the former is true, then use the USEREXIT_CHECK_* exits in MV45AFZB; if the latter is true, then you are most likely stuck with USEREXIT_SAVE_DOCUMENT_PREPARE.

Read only

Former Member
0 Likes
948

I used the prepare routine, and after my wanring message I put leave to screen 4001, and the fields all became available again

Read only

0 Likes
948

Hi,

I wouild suggest not to put that statement in the userexit_save_document_prepare - 'leave to screen XXXX' , since this exit will be called in background and in other applications too when called remotely.

Without the Leave to screen statement also it would be in the same screen without greying out the fields.

Thanks,

Vamshi.