Академический Документы
Профессиональный Документы
Культура Документы
Welcome Guest
Replies: 12 - Pages: 1 - Last Post: Oct 12, 2009 8:55 PM Last Post By: Tamas Hoznek
I'm investigating an option on how to cancel the saving process of a document in user-exit include MV45AFZZ from within transaction
VA01/VA02.
Setting any screen like SET SCREEN 0 or LEAVE TO SCREEN 0 or any similar things did not work either.
What am I trying to do? I would like to check some VBAP/VBAK fields if certain conditions are met and cancel the saving process if
necessary - of course without dropping the complete document.
I've already searched the forum here and only found hints like those already mentioned above - but nothing really specific.
Another thing which came into my mind is what about storing some a line into the incomplete log of the transaction to prevent from
saving? However, I did not found any function module to add some lines to the log in user-exit MV45AFZZ so far.
You should achieve it by calling message type E in user-exit USEREXIT_SAVE_DOCUMENT_PREPARE - I've done it many times and
it worked.
Best regards,
Marcin
I've tried this already, however the problem is after confirming the red error message by pressing ENTER, the transaction immediately
enters FORM USEREXIT_SAVE_DOCUMENT_PREPARE again and shows this error again - this continues unless I switch to another
transaction.
The user is not able to change the field values which caused the error message to appear anymore.
So basically I'm searching for a way to cancel document saving with e.g. an error message or similar and let the user, after confirming
the message, modify the document again to get rid of this error.
Michael
Regards,
Raymond
fcode = 'ENT1'.
message e999(Z1) with 'Error occurred, press enter to continue...'.
Regards,
Naimesh Patel
This will display a message about the problem or the reason for not saving the document, and stay on the same screen where the
user was when clicking on 'Save'.
that's the best solution ever- Thanks for this! This solved my problem at the end - points awarded!
Michael
I got the same problem and the solution posted here has some major drawbacks: the user exit is also performed by several BAPIs
which will not work as they should anymore!
The reason for that is that is because the BAPI doesn't terminate with an error as it should. The code after calling the BAPI cannot be
reached anymore and if the BAPI is called within a loop you terminate this to. And last but not least you cannot handle this error in
your code so the user just won't know what just happened.
Has anyone got an better solution? Maybe use another userexit to fill a message table and stop the Fuba from saving the sales
document?
/chris
you may be right that this will cause some troubles when the User-Exit has been called from a previous BAPI call.
In my case I would like to stop the saving process when the user has entered some values into the material configuration which are
not allowed. This condition, too, depends on some more conditions and cannot be caught elsewhere.
In my specific case, I don't execute this check (and hence the cancellation of the saving process) when the user-exit was called from
within a BAPI.
Michael
how do you achieve that the check/cancellation is not performed in a BAPI call?
in my case the check/cancellation should always be performed so that the same restrictions are valid for all transactions on the
system. why would you like to prevent the creation of faulty sales documents in VA01/VA02 but not in other transactions.
in my case i implemented the check before calling the BAPI as a work around till i find a better solution.
still other developers have will have trouble with these codings either the will wonder why the desired check does not work or they will
wonder why their BAPI call leads to a leave to screen.
> how do you achieve that the check/cancellation is not performed in a BAPI call?
CALL_BAPI is available at least in MV45AFZB and MV45AFZZ, if I create a sales order from e.g. SD_SALESDOCUMENT_CREATE
or SD_SALESDOCUMENT_MAINTAIN.
Better would be of course to show the warning/error message only when the user-exit is called from online processing and when
called from batch or BAPI or similar it should write a message into the BAPIRET* structures or perhaps into the incompletion log of the
document. So far I could not figure out how to do logging.
Michael