Triggering Events for HR

Holt, Pamela F pholt at ncdot.gov
Thu May 21 17:54:17 EDT 2009


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<mailto:lynne.allen at kodak.com> | 585-724-3556 Office |
www.kodak.com<http://www.kodak.com/>
[cid:791393521 at 21052009-03C9]

________________________________
Email correspondence to and from this sender is subject to the N.C. Public Records Law and may be disclosed to third parties.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.mit.edu/pipermail/sap-wug/attachments/20090521/7deb0e39/attachment.htm
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ATT00001.gif
Type: image/gif
Size: 826 bytes
Desc: ATT00001.gif
Url : http://mailman.mit.edu/pipermail/sap-wug/attachments/20090521/7deb0e39/attachment.gif


More information about the SAP-WUG mailing list