Raising a User Decision Result Externally

Kjetil Kilhavn KJETILK at statoil.com
Fri Mar 22 04:34:51 EST 2002


I may earn a spot in the Worst Practises reference for this maybe, but I had the
need to automatically terminate some workflows (in a way that it appeared the
user had completed a user decision) and solved it as described below. My
scenario was that a rejected timesheet document in our non-standard approval
system had been cancelled by the user, and by terminating the workflow for the
corresponding document the document would be returned to the approver. Normally
the user should choose to return the document, this solution picked up those
that cancelled the document without checking their workflow, and those that
cancelled the document and thought that was enough.
 
First I need to find the active work flow item (you may not need to do that)
I select from swwihead all workitems with the correct task type created around
the time of the rejection (plus/minus five minutes)
Inside I select from sww_contob for the corresponding work items and also
matching on element name, object type and value
Inside this select I assign the work item ID from swwihead-wi_chckwi
By assigning every time, when the looping is finished I have the latest
rejection workflow for this document
 
I then select from swwihead again, now matching wi_chkwi and looking for the
first (select single) normal work item which is not completed.
If the work item found is not the decision task I complete the work item
(SWW_WI_ADMIN_COMPLETE) to get the decision task (will always be the next one).
If required (work item found was not decision task) another select is performed.
 
Finally I am now ready to do what I wanted.
I look in sww_cont to see if there is an element = wi_result_const (defined in
RSWWINCL)
If one is found I update the value and modify the table row, otherwise I insert
a new row with the correct values.
The scene is then ready for a coup de grace - a call to SWW_WI_ADMIN_COMPLETE
for this work item.
--
Kjetil Kilhavn
 
 
 
 
|--------+------------------------------>
|        |          "Wall, John MJ      |
|        |          SITI-ITDSEA"        |
|        |          <John.J.Wall at is.shel|
|        |          l.com>              |
|        |          Sent by: SAP        |
|        |          Workflow            |
|        |          <Owner-SAP-WUG at MITVM|
|        |          A.MIT.EDU>          |
|        |                              |
|        |                              |
|        |          22.03.2002 09:37    |
|        |          Please respond to   |
|        |          "SAP Workflow Users'|
|        |          Group"              |
|        |                              |
|--------+------------------------------>
  >----------------------------------------------------------------------------|
  |                                                                            |
  |       To:     SAP-WUG at MITVMA.MIT.EDU                                       |
  |       cc:     (bcc: Kjetil Kilhavn)                                        |
  |       Subject:     Raising a User Decision Result Externally               |
  >----------------------------------------------------------------------------|
 
 
 
Dear Workflowers.
 
I am currently on 40B and am sending a user decision to a user but I also
want to control this externally tricking workflow into thinking that the
user has pressed one of the user decision options (001-Approve, 002-Reject).
Does anyone know a function module that would do this?
 
Kind Regards
John Wall
Mob: +31 6 4801-2251,  Email: johnwall at iname.com
 
 
-------------------------------------------------------------------
Statoil: The information contained in this message may be CONFIDENTIAL and is
intended for the addressee only. Any unauthorised use, dissemination of the
information or copying of this message is prohibited. If you are not the
addressee, please notify the sender immediately by return e-mail and delete this
message.
Thank you.
 


More information about the SAP-WUG mailing list