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: 

In update task & Express document Update was terminated

Former Member
0 Kudos

Hi all

Need help!

Requirement: When i do confirmation through CO11N i have to do GI through a BADI.

Solution: I have written a wrapper Update module(internally has /AFS/BAPI_GOODSMVT_CREATE) with Start delayed and called that module(in update task) in the method MB_DOCUMENT_BEFORE_UPDATE of the definition MB_DOCUMENT_BADI.

It works fine when every thing is correct, but if GI fails its still confirms the confimation and "Express document Update was terminated" pops up when i push the back button. I have written a abort statement in the update module if goods movement fails. When i check SM13 it shows the reason for erroring out. But my requirement is to stop the complete transaction if GI fails and put the error message at the bottom of screen(CO11N)

How can i do this?

Appreciate any suggestions.

2 REPLIES 2

martin_voros
Active Contributor
0 Kudos

Hi,

I don't think that it is possible. It's too late to call rollback. The FM in update task is called after command COMMIT WORK. Here is a quote from ABAP documentation:

If during the update an error occurs, the update work process executes a database rollback, returns the log record with a note into table VBLOG and informs the user whose program has created the log record by SAPMail. After removing the error cause, the returned log records can be updated again.

So you should call that module only in case that you are 100% sure that it will be processed correctly.

Cheers

former_member555112
Active Contributor
0 Kudos

Hi,

The BADI method MB_DOCUMENT_BEFORE_UPDATE is called in an update task.

So you cannot issue an error message or give an abort statement within this badi.

It is not permitted.

Check the documentation of the BADI.

Try using the BADI MB_MIGO_ITEM_BADI instead.

Simulate your process here and issue error or warning messages any in this badi.

If everything is succesfull then just carry out your changes in MB_DOCUMENT_BEFORE_UPDATE but do not state explicit COMMIT WORK statement.

Regards,

Ankur Parab

Edited by: Ankur Parab on Aug 1, 2009 1:45 PM