Triggering a workflow from a function module

Breslavets, Sergey Sergey.Breslavets at anheuser-busch.com
Mon Jan 20 12:46:54 EST 2003


Hi Hans,
 
what kind of error do you receive?
 
The flag 'Take_Workitem_Requester' simply tells the SWE_EVENT_CREATE to
determine and put the requester ID into the event container.
 
the _EVT_RECEIVER_ID is internally populated by the event manager when any event
(including terminating) is created. Event receivers are determined dynamically
based on the linkage information, and the element is not intended to be
populated by calling application -  any value you try to pass there will be
overwritten.
Basically, for each found event receiver the event manager will try to determine
it's ID and then pass it to the receiver FM in the event container element
_EVT_RECEIVER_ID.
 
When a workitem which has a terminating event is created, the event linkage for
this workitem is published in the instance event linkage tables.
SWE_EVENT_CREATE checks this table and trigger processing for each event
recipient found - the corresponding id is passed to the receiver function module
in _EVT_RECEIVER_ID container element and recorded in the event log... This is
so-called 'Instance Linkage'.
In case of 'type linkage' (i.e. when you use an event to trigger a workflow) the
field is populated with the ID of the workitem created by the event receiver FM.
 
 
Regards,
Sergey
 
-----Original Message-----
From: Hans Brilleman [mailto:Hans.Brilleman at capetown.gov.za]
Sent: Monday, January 20, 2003 4:00 AM
To: SAP-WUG at MITVMA.MIT.EDU
Subject: Re: Triggering a workflow from a function module
 
 
Hi Richard,
 
Yes, the requestor does have the correct authorizations.
 
You say that the _EVT_RECEIVER_ID is normally populated when a
terminating event is published. How will that fall in place with me
creating an event for my workflow to trigger? I am not sure where or how
the terminating event fits in the picture.
 
Could you possible shed some more light on this?
 
Much appreciated.
 
Thanks,
 
Hans.
 
>>> rvmarut at earthlink.net 01/18/03 11:17pm >>>
Hans,
 
_EVT_RECEIVER_ID is intended to hold a work item id and is normally
populated when a terminating event is published.
 
Does the person staring the workflow (requestor) have the correct
authorizations?
 
Your code looks fine and should work. To get the requestor of the
workflow, I have included _EVT_CREATOR in the event binding to the
WF_INITIATOR element.
 
Richard Marut
The Consulting Highway, Inc
 
 
-----Original Message-----
From: SAP Workflow [mailto:Owner-SAP-WUG at MITVMA.MIT.EDU] On Behalf Of
Hans Brilleman
Sent: Saturday, January 18, 2003 7:57 AM
To: SAP-WUG at MITVMA.MIT.EDU
Subject: Triggering a workflow from a function module
 
Hi,
 
I am trying to trigger a workflow from a function module. The building
of the container elements seems fine, but the triggering of the event
using SWE_EVENT_CREATE is not so succesfull. It gives an inconsistent
error regarding the requester. If I then export a value of X in the
field take_workitem_requester, it is happy (which I do not understand
as
it seems that generally it defaults with a space and is not a
mandatory
field for passing a specific value). BUT - now  receiverid (or RECID)
stating that it is invalid. I have tried for testing purposes to
populate the container element _EVT_RECEIVER_ID  with a value of
WF-BATCH. It worked for a while, but now all of a sudden it does not
anymore and gives the error again. Could anybody give me a idea of
what
the purpose of this element is, and what the values are that the event
creation requires.
 
Below see a extract of my  program code.
 
        SWC_CREATE_OBJECT INSTLN 'INSTLN' Z_ANLAGE.
        SWC_SET_ELEMENT CONTAINER 'instln' INSTLN.
        SWC_SET_ELEMENT CONTAINER 'CSRID' SY-UNAME.
        SWC_SET_ELEMENT CONTAINER 'MoveOutDoc' Z_MOVEOUT_DOCUMENT.
        SWC_SET_ELEMENT CONTAINER '_EVT_RECEIVER_ID' 'WF-BATCH'.
 
        objtype = 'MOVEOUTDOC'.
        objkey  = Z_MOVEOUT_DOCUMENT.
        event   = 'MODisconnect'.
 
        call function 'SWE_EVENT_CREATE'
             EXPORTING
                  objtype                 = objtype
                  objkey                  = objkey
                  event                   = event
                  take_workitem_requester = 'X'
             TABLES
                  event_container         = CONTAINER
             EXCEPTIONS
                  objtype_not_found       = 1
                  others                  = 2.
 
Thanks,
 
Hans Brilleman
 


More information about the SAP-WUG mailing list