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: 

Sales Document getting saved even after error message

Former Member
0 Kudos

Hi,

I am giving order type in VA01 Tcode and then Clicking on 'Create with Reference' .Then a Pop Up is getting generated. In this i am giving Contract already created (using VA41 Tcode) and then clicking on 'Copy' button.In the generated Screen i am giving quantity at Item Level. When saving, If this quantity exceeds referenced Quantity Contract Quantity i am generating error message by using the Program MV45AFZZ.

IF TOT_QTY1 > V_QTY.

MESSAGE E002(ZMSG2) WITH V_QTY Z_QTY LEFT_QTY1.

ENDIF.

After error message got generated ,if i Save it again,the document is getting saved.But i dont want

the document to get saved if there is error message. Please help how can i do this.

Thanks

K Srinivas

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi Srinivas,

Use EXIT after the message, then your problem must be solved.

Regards,

Kranthi Namala,

91 99860.35735.

6 REPLIES 6

Former Member
0 Kudos

Hi,

You should put your coding inside routine USEREXIT_SAVE_DOCUMENT_PREPARE or USEREXIT_SAVE_DOCUMENT to avoid document save once an error message occurs.

Cheers,

0 Kudos

Thanks for the reply.i kept my code in FORM USEREXIT_SAVE_DOCUMENT_PREPARE but first time when i click on SAVE the error message is showing. When i again click on SAVE it is asking 'Would you like to Save or Edit' and when i click on Save the document is getting saved.Please resolve.

0 Kudos

Hi,

In this case, you may need to put your logic inside routine USEREXIT_SAVE_DOCUMENT, so that the logic will called during saving data.

Hope this help.

Cheers.

Former Member
0 Kudos

Hi Srinivas,

Use EXIT after the message, then your problem must be solved.

Regards,

Kranthi Namala,

91 99860.35735.

0 Kudos

i placed 'Exit' after the message. Even then the problem is not resoved.Please help.

Thanks

K Srinivas

0 Kudos

Thanks for the reply. Its working after placing the Exit after statement.