Raising a User Decision Result Externally

Ulrich Mende wug at mende-edv-beratung.de
Fri Mar 22 08:24:12 EST 2002


Hi John and Kjetil,
here is another way to trick your workflow from outside.
Define two events, say APPROVED and REJECTED and trigger them from
outside accordingly.
 
In the workflow insert a fork 1(3), in brach 1 put your decision task,
in branch 2 an event receiver that waites for APPROVED, in tbranch 3 an
event receiver, that waites for REJECTED.  In brach 2 insert the steps
that follow in brach 1 after 001, in brach 3 insert the steps that
follow in branch 1 after 002. Now if one of the two external events is
triggerd, the workitem for the user decision is automatically killed.
Othewise the user can execute the item and the workflow is continued
without waiting for the events any more.
 
in ABAP-like-code:
 
fork 1(3)
  branch 1:  task user decision(result)
             case result.
               when 001:  steps after approved...
               when 002:  steps after rejected...
             endcase.
  branch 2:  event receiver for APPROVED
               steps after approved
  branch 3:  event receiver for REJECTED
               steps after rejected
endfork.
 
If you dont't want to have the steps twice, put the decision task in a
subflow returning the decision result to your workflow. In the event
branches simply set the result to 001 or 002 respectively.
Behind the fork insert a multi-level-switch (case) on that result. Then
the workflow could look like this:
 
 
data result.
 
fork 1(3)
  branch 1:  subflow decision importing result.
  branch 2:  result = 001.
  branch 3:  result = 002.
endfork.
 
case result.
  when 001:  steps after approved...
  when 002:  steps after rejected...
endcase.
 
Best regards Uli
 
If your object type doesn't have the required events:
May be it is difficult for you, to change your object type to insert the
events. Then take in account that Your events can be triggerd by an
object instance of any suitable object type. This must not necessary be
the same
object type as that in your workflow. You even can create your own very
simple object type (without any data base tables, without any coding)
that has the one and only task to trigger your workflow.
 


More information about the SAP-WUG mailing list