cancel
Showing results for 
Search instead for 
Did you mean: 

Condition on Terminating event for a user only

Former Member
0 Kudos

Hi All,

I have a Terminating Events ( ZApprove/ZReject) in one of the asynchronous task and have this in a loop for 3 level approval.

The approver can programatically run the SAP_WAPI_EVENT_CREATE to give his decision externally thorugh the frontend by triggering the Z events

Then the workitem is moved to the second approver and so on.

Problem is , How can I put some additional condition on the terminating event so that it should check whether the user has the workitem before triggering the termaniating event.

Why I want to do is because when the same user triggers the event twice then this actually completes the second workitem created in the loop in addition to the first workitem.

Ex) First approver triggers the event twice by mistake

Terminating event just looks for the object key to complete the workitem.

Hope I was clear.

Thanks,

Charan.

Accepted Solutions (0)

Answers (1)

Answers (1)

imthiaz_ahmed
Active Contributor
0 Kudos

May be the concept is misunderstood here. The workflow generates a new work item once it receives the terminating event to explain precisely and therefore there is no point in doing a check on that. Anyhow, no matter how many times the terminating event happens the WF should have created a new item in place. Hope this clears your question.

Regards, IA

Former Member
0 Kudos

Hi IA ,

Thanks may be I was not clear explaining ;-).

I agree that the WI id is new eveytime a workitem is created in a loop but the system looks for a terminating event with a unique key which is the same for both the workitem's created in the loop.

The unique key I mean is the Business Object Key.

So if u trigger the event twice it completes the first workitem in user A's inbox and the second time it completes the new workitem created in the loop which is sent to User B, though both the workitem are in two diffrent user's inbox and have two difffrent WI id.

I mean user A when triggering the event twice by mistake would actually complete the new workitem which in now in user B's inbox.

A rare error instance but still worth considering hole

Thanks for looking at this question.

Hopefully I explained it clear.

Former Member
0 Kudos

This quite interesting scenario!!!!!!! I think you can try with following

Remove the Terminating event and may be instead put this event in a wait for event step that is placed in 1 of the parallel branch of a fork which has 2 parallel and 2 necessary branch. In the other branch you put the activity step of the user where he triggers the event. Now on completion of this task there should be a binding of a flag from task to Wflow which will be set if the step gets executed. Now the wait for event step in the other branch should be inside a loop that terminates only when the Flag is set to X. I think this will resolve the issue. If required you can also play with EVT_CREATOR container element of Event.

Thanks

Arghadip

Former Member
0 Kudos

I suggest that you keep the terminating event. However, in your custom transaction, add logic to determine (flags, status, etc.) if event should be created.

Former Member
0 Kudos

Thanks Arghadip for the solution.

But Since this is a multilevel approval scenario we dont know how many parallel branches is required at any time.

I was just wondering how this was addresses by SAP or did some one get into such a situation.

May be the moderator or some one who have come up with such a situation can share it here.

Meanwhile for the solution, I reverted back to the traditional syncronous task so each approval is unique based on the workitem id.

Is it like according to SAP, if its a asynchronous task waiting output from external source then this task is just single level and cannot be used in multi level approval ?

Gave points to Arghadip for attempting

Thanks,

Charan.