Can we complete a workitem when it is still under "execution"?

I have one task in my gui inbox(SBWP), when I try to execute it(Click the execute button) I found it locked the workitem(From transaction SM12) in my terms at once, now if I try to complete the workitem with one "Event" in my application, I found the "Event" can not complete the workitem because it is locked by me,but if I leave the "execution" at once after I triggered the "Complete" event for the workitem, it works then. so I guess
1. the FM:SWL_WI_EXECUTE lock the workitem first
2. the FM:SWL_WI_EXECUTE will "execute" Application BO Method to go to application screen.
3. The application trigger one event to complete the workitem without leaving.
4. But the workitem is still locked by SWL_WI_EXECUTE, so when the event receiver WF-BATCH try to change the status of the workitem, it failed, the workitem is not completed.
My question is DO WE HAVE A WAY TO DEQUEUE THE WORKITEM BEFORE LEAVING TO SBWP?
Thanks and best regards.

Hi,
This is correct behaviour for terminating events. The problem is that the terminating event could come from another user, which is why the task is locked whilst you are executing it. Normally the lock should not present a problem as the event would then be processed at a later stage, sometimes with the error monitoring job - i.e. up to 20 minutes later.
The solutions suggested by Glauco to use a terminating event in another branch of a fork will also work, but you will have the same issue: the work item will remain locked, the fork completes and the workflow will move on, leaving one in process item behind. This item eventually gets set to completed by the error monitoring job.
Perhaps you could also look at the way in which you are raising the event. When raising events directly from within an application is that the event should always be one of the very last things that are done.
Hope that helps,
Mike

Similar Messages

Maybe you are looking for

  • Can not see "Compose" option in the visual Composer

    Hi all I am new to Visual Composer. I have created a model. But I am unable to add a page because I can not see the "Compose" option. Can somebody pls tell me the reason. Its urgent! Thanks a lot. Karan

  • External Hard drive is suddenly Read only.  Help!

    I reformatted my I mac due to it being extremely slow. After reformat, the toshiba external hard drive that I have been using for months before with no problem, is now a read only. I have over 1TB of space available and I need to use it. Does anyone

  • Error in Restricted Column of Analytic View

    Hi, I created a Analytical view and performed join between the tables. All the data has been populated successfuly. I restricted for the Column PER UNIT SALES PRICE based on the attribute value MATERIAL_NUM = 25. I do get an error when i validate the

  • Conditional approval for payment

    Hi Experts,                wanna set approval for on- account outgoing payment . Tried following queries but not working. Kindly suggest the correct one SELECT (Case When (select $[ovpm.nodocsum.0]) > 0 then 'TRUE' Else 'FALSE' End) TF FROM OVPM wher

  • Cover photo in an Iphoto book.

    How do I change the cover photo in an Iphoto book.  It seems to select one randomly.