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: 

How can I delete a item programitically, from all 5 associated user's inboxes?

former_member194142
Participant
0 Kudos

Hello

We are triggering a custom workflowm wherein the my workflow sends emails to user's SAP office workflow (say, 5 users) inbox for their decision (Accept / Reject), well.

Currently: Say, for example, User_1 accepted the work_item_1, hence the standard SAP is deleting the same work item from the rest of the 4 user's inboxes, well

New requirement: Say, We triggered the email and sent the emails to all 5 users, but say next day bcz of budget cut issues the Manager cancelled / closed the order/project, but already workflow sent emails all 5 users inboxes

Now, without knowing the fact that the order/proposal/project has been cancelled / closed the User_1 is clicked the ACCEPT button, at this moment (upon clicking the ACCEPT button) I need to put a validation that, if the order/prposal/project is cancelled/closed ALREADY, then I need to throw the same message and need to delete this item from all user's inboxes including User_1's inbox

I achieved & done most of the piece, but I need to do the red text part, pls. let me know How can I delete the work item in question from the current user's inbox and all other user's inbox as well, I mean, i need to do this programitically?

Thank you

1 ACCEPTED SOLUTION

karthikeyan_p3
Contributor
0 Kudos

Hi,

It can be achieved using fork step.

Check whether any event is getting triggered when the order/proposal/project is cancelled. If not raise a custom event when the order/proposal/project is cancelled.

Include a fork step with 2 (Branches Parallel Branches - 02). In one branch, include your user decision step and in another branch include the step WAIT for event. Maintain the End of condition of fork as Necessary Branches  01.

So the workitem will reach approvers inbox and when the order is cancelled, wait step will capture the event and end the fork. Also the workitem will be removed from approvers inbox.

Check the demo workflow template: WS77300048

Thanks,

Karthikeyan

2 REPLIES 2

karthikeyan_p3
Contributor
0 Kudos

Hi,

It can be achieved using fork step.

Check whether any event is getting triggered when the order/proposal/project is cancelled. If not raise a custom event when the order/proposal/project is cancelled.

Include a fork step with 2 (Branches Parallel Branches - 02). In one branch, include your user decision step and in another branch include the step WAIT for event. Maintain the End of condition of fork as Necessary Branches  01.

So the workitem will reach approvers inbox and when the order is cancelled, wait step will capture the event and end the fork. Also the workitem will be removed from approvers inbox.

Check the demo workflow template: WS77300048

Thanks,

Karthikeyan

muneshpatwari
Active Participant
0 Kudos

Hi,

You can use the FM 'SAP_WAPI_WORKITEMS_TO_OBJECT' to get all the active instances of the work item and once you have it, you can use those active instances using the FM:

'SAP_WAPI_WORKITEM_DELETE'.

Regards,

Munesh.