Triggering a workflow from a function module

Breslavets, Sergey Sergey.Breslavets at anheuser-busch.com
Tue Jan 21 11:19:51 EST 2003


Hans,
 
check if you have any binding defined for the element '_REQUESTER' for the event
receiver, or if the element is defined as the (mandatory) parameter for your
event (in BOR)?  If so, this can be the reason for the error message...
 
Also, do you use standard event receiver (SWW_WI_CREATE_VIA_EVENT) or custom FM?
 
Sergey
 
-----Original Message-----
From: Hans Brilleman [mailto:Hans.Brilleman at capetown.gov.za]
Sent: Tuesday, January 21, 2003 3:14 AM
To: SAP-WUG at MITVMA.MIT.EDU
Subject: Re: Triggering a workflow from a function module
 
 
Hi Sergey,
 
the error it gives is 'invalid recid'.
 
What you explained, makes sense, that is why Ido not understand the
problems I am experiencing.I did however try something else, and now it
works - but it still does not make sense. I saw that the element
_REQUESTER was empty, so I populated it with the workflow initiator. Now
it works..... I dont know why, and this worries me, because according to
me it should also be determined by the event manager.
 
Maybe you could shed some light on this.
 
Many thanks,
 
Hans
 
>>> Sergey.Breslavets at anheuser-busch.com 01/20/03 07:46pm >>>
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