Work Item Approval/Rejections

Kjetil Kilhavn list.sap-wug at vettug.no
Tue Mar 12 02:48:09 EDT 2013


Mandag 25. februar 2013 14.37.22 skrev David G Cooper:
> As a result the custom application has an approval sub screen with two
> buttons.  This is delivered to the user via a BOR object method/Task using
> Set parameter ID and a "Call Transaction".  The idea being that once the
> decision is made the result can be returned to the work item.
>
> The Task is contained within an Until Loop to make sure a decision is made,
> before the work flow continues.  I now need to return the result of the user
> decision from the custom application back to the work item.
> 
> What have I tried,
> 1) Raise Event and leave program where the task has terminating events.
>     When pressing BACK/EXIT/CANCEL buttons the user experiences a continual
> loop back to the approval screen.
There is a good reason for the "Cancel and keep work item" in standard 
decision tasks - and you have just encountered it. Cancelling because one is 
not able to make the decision at the moment (or for whatever reason) is always 
a valid decision.

>     The current work item completes, but as a decision has not been made, a
> new instance of the work item is created and immediately redisplayed to the
> user without going through the SAP Inbox again.  Result no way to exist
> without choosing a decision.
>    If one of the decision buttons is pressed an event is raised and the
> program completes.  However this results in the work item completing, but
> not returning the correct event, so loops back and presents the transaction
> again without going through the SAP Inbox.
I would say the best solution for you is to include the "Cancel" decision in 
your model. There are many ways you can solve this.

If it is possible (step not depending on the setting when the first work iem is 
received) you can get away the easy way by unchecking "Processing of complete 
chain". The new work item will then not be started automatically.

Another way to solve it is to use a "Complete execution" condition to check 
that there is a decision. The existing work item will then be kept in the 
inbox which is better as the creation date is not changed and history is kept 
(fewer work items in the log, so better for system administrators too).

A third way is to implement the same functionality that the macro 
EXIT_CANCELLED provides. I have never done this and am not sure exactly how, 
but by looking at a step definition (outcomes) now it seems you can get away 
simply by raising a class-based exception which inherits from 
CX_BO_ACTION_CANCELLED. As always, the availability of this depends on your 
version - but since you are not stating it I assume you are on the latest & 
greatest.
-- 
Kjetil Kilhavn (list: SAP-WUG) / Vettug AS (http://www.vettug.no)


More information about the SAP-WUG mailing list