Triggering Events for HR

Karl Nietz knietz at csc.com.au
Thu May 21 21:55:36 EDT 2009


Hi,

I have tried identifying and deleting redundant workflow instances using a 
check function module but found it unreliable - as pointed-out in a 
previous related post the workflows are all created in the same LUW.  I 
actually solved the problem by using the FM SAP_WAPI_WORKITEMS_TO_OBJECT 
as an initial step in the workflow template to identify duplicate 
instances and then delete them (again described in an earlier post) and it 
worked ok, although the overhead is that unecessary instances are created. 
 If you have control over the raising of the event then the terminating 
event solution suggested seems promising.

Karl Nietz
 




"Holt, Pamela F" <pholt at ncdot.gov> 
Sent by: sap-wug-bounces at mit.edu
22/05/2009 07:54 AM
Please respond to
"SAP Workflow Users' Group" <sap-wug at mit.edu>


To
"'SAP Workflow Users' Group'" <sap-wug at mit.edu>
cc

Subject
RE: Triggering Events for HR






I have two solutions. 
 
First solution:
1. Using a "fork" step, put a "wait for terminating event" in your 
workflow (if you don't already have one) that starts where the workflow 
starts and ends where the workflow ends.
2. In your program, raise the terminating event right before you raise 
your triggering event.  This will terminate the workflow that is running. 
Follow the terminating event with a COMMIT WORK AND WAIT, so that the 
workflow you are about to start doesn't get terminated by mistake.
3. Raise your triggering event.
 
 
Second solution:
If the workflow doesn't already have a check function module, create one. 
Insert the following code into the check function module.  This will 
terminate the workflow that is already running in the check function 
module, before the workflow actually starts.
 
  DATA: t_sww_contob TYPE TABLE OF sww_contob WITH HEADER LINE. 
  DATA: xswwwihead   TYPE TABLE OF swwwihead WITH HEADER LINE.
  DATA: icount       TYPE i.
 
  CLEAR:   t_sww_contob.                   "look for an active workflow
  REFRESH: t_sww_contob.
 
  SELECT * FROM       sww_contob
           INTO TABLE t_sww_contob
           WHERE      objtype = '<business_object_name>'
           AND        objkey  = objkey
           AND        element = '<business_object_name>’.
 
  IF sy-subrc = 0.
    DESCRIBE TABLE t_sww_contob LINES icount.
    IF icount GT 0.
      LOOP AT t_sww_contob.
        SELECT SINGLE * FROM  swwwihead
                        INTO  xswwwihead
                        WHERE wi_id = t_sww_contob-wi_id.
 
        IF sy-subrc = 0.                   "an active workflow is found
          IF xswwwihead-wi_stat = 'READY'    OR
             xswwwihead-wi_stat = 'WAITING'  OR
             xswwwihead-wi_stat = 'SELECTED' OR
             xswwwihead-wi_stat = 'STARTED'.
               RAISE <exception>.
          ENDIF.
        ENDIF.
 
      ENDLOOP.
    ENDIF.
  ENDIF.
 
The difference between the two solutions is that the first solution will 
always keep the last workflow that was started, while the second solution 
keeps the first one. But they both terminate the workflow before it 
actually starts executing.
 
Regards,
Pam Holt
NCDOT

From: sap-wug-bounces at mit.edu [mailto:sap-wug-bounces at mit.edu] On Behalf 
Of lynne.allen at kodak.com
Sent: Thursday, May 21, 2009 11:54 AM
To: sap-wug at mit.edu
Subject: Triggering Events for HR


This is a very basic question.... 
    When creating a recurring payment in HR, an SAP event of CREATED 
(object recurrpay)  is raised for each different wage type used for an 
employee. 
    For instance, if there are 3 wage types, 3 events are raised for the 
SAME employee.  After the creation of the payment and the save key is hit 
the event kicks off, so for each payment for the same employee we are 
getting 3 events. We do not want to start the WF 3x. 
 We want to start a workflow ONE time, as long as one payment exists start 
the workflow, from there it does not matter how many payments are entered. 
 Any thoughts on how this can be done without started the workflow for 
each time? 


 
Lynne M. Allen | ERP Workflow Development | Worldwide Information Systems 
(WWIS) | 
Eastman Kodak Company | 343 State Street | Rochester, NY 14650-1221 | 
lynne.allen at kodak.com | 585-724-3556 Office | 
www.kodak.com 


Email correspondence to and from this sender is subject to the N.C. Public 
Records Law and may be disclosed to third parties.
_______________________________________________
SAP-WUG mailing list
SAP-WUG at mit.edu
http://mailman.mit.edu/mailman/listinfo/sap-wug


-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.mit.edu/pipermail/sap-wug/attachments/20090522/173cba1a/attachment.htm
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: image/gif
Size: 826 bytes
Desc: not available
Url : http://mailman.mit.edu/pipermail/sap-wug/attachments/20090522/173cba1a/attachment.gif


More information about the SAP-WUG mailing list