Checkfunction in SWEC/SWEINST

workflow99@aol.com workflow99 at aol.com
Mon Oct 10 16:13:23 EDT 2005


Manish,
 
Where exactly are you using this FM? SWEC or SWETYPV?
What release are you currently on?
I don't think FUNCTION 'SWE_EVENT_GET_RECEIVERS' will tell you if there is an active workflow for the object key. Look for appropriate SAP_WAPI_* functions.
Since you want trigger the event only for specific document types, you need to do a document type check before creating the event. 
 
Regards,
Ramki Maley
Workflow Developer, USCBP.
248-613-1287 (C)
 
-----Original Message-----
From: Khanna, Manish <manish.khanna at amd.com>
To: SAP Workflow Users' Group <sap-wug at mit.edu>
Sent: Mon, 10 Oct 2005 14:31:17 -0500
Subject: RE: Checkfunction in SWEC/SWEINST


Hi Ramki,
 
Here is the code I want to put. However I also tested it using SWE_EVENT_CREATE with values hardcoded.
 
*************************************************
 
DATA: EVENT_RECEIVERS LIKE SWELOG OCCURS 2,
TOTAL_RECEIVERS TYPE N.
 
*check if there are any active recievers. (Since this is a change event we have receivers in our approval workflow, 
*to cancel if changed in between). So if no reciever that means no existing WF , trigger 'RELEASESTEPCREATED'.
 
CALL FUNCTION 'SWE_EVENT_GET_RECEIVERS'
EXPORTING
OBJTYPE = OBJTYPE
OBJKEY = OBJKEY
EVENT = EVENT "AMD_CHANGED
* CREATOR = ' '
* TAKE_WORKITEM_REQUESTER =
TABLES
* EVENT_CONTAINER =
EVENT_RECEIVERS = EVENT_RECEIVERS
* RECEIVER_INFO =
* EXCEPTIONS
* OBJTYPE_NOT_FOUND = 1
* OTHERS = 2
.
IF SY-SUBRC = 0.
 
DESCRIBE TABLE EVENT_RECEIVERS LINES TOTAL_RECEIVERS.
 
IF TOTAL_RECEIVERS = 0.
 
CALL FUNCTION 'SWE_EVENT_CREATE'
EXPORTING
OBJTYPE = OBJTYPE
OBJKEY = OBJKEY
EVENT = 'RELEASESTEPCREATED'
CREATOR = SY-UNAME
* TAKE_WORKITEM_REQUESTER = ' '
  START_WITH_DELAY = 'X'
* START_RECFB_SYNCHRON = ' '
* NO_COMMIT_FOR_QUEUE = ' '
* DEBUG_FLAG = ' '
* NO_LOGGING = ' '
* IDENT =
* IMPORTING
* EVENT_ID =
* TABLES
* EVENT_CONTAINER =
* EXCEPTIONS
* OBJTYPE_NOT_FOUND = 1
* OTHERS = 2
.
 
ENDIF.
ENDIF.
***********************************
 
Regards
Manish




From: sap-wug-bounces at mit.edu [mailto:sap-wug-bounces at mit.edu] On Behalf Of Workflow99 at aol.com
Sent: Saturday, October 08, 2005 4:21 PM
To: sap-wug at mit.edu
Subject: Re: Checkfunction in SWEC/SWEINST


Hi Manish,
 
1) The Event function module assigned in SWEC is called everytime the specified change takes place. It is not necessary that the event have a receiver. A Check function module is assigned to a Event - Receiver combinationin in SWETYPV and it does not get executed unless the event linkage is active.
 
2)
  a) The Event FM is called in the update module and it is possible that locks are not released until all the updates are completed. 
  b) I did come across a similar situation for one of my BOs - but it was an SAP bug. I circumvented the problem by using a check in my event FM.
 
Perhaps, I can help more if you can post the code of yor FM.
 
Regards,
Ramki Maley
Workflow Developer, USCBP.
248-613-1287 (C)
 
 
In a message dated 10/8/2005 3:09:58 PM Eastern Standard Time, manish.khanna at amd.com writes:
Hi,
 
Now that I have realized that consignment documents cannot have release strategy and our requirement is to trigger an approval workflow when a consignment document is "changed" I thought of the following.
 
1. Create a check function.
2. Attach it (in SWEC)  to change object EINKBELEG / BUS2013 / On Change / Changed(event in BUS2013)
3. The check function triggers BUS2013/'RELEASESTEPCREATED' event.
 
Now this seems to be a solution, but its not working.
 
Why ?? Because
1. It seems that the check function is not called every time. After some analysis it seems that if BUS2013/CHANGED does not have a receiver, it does not calls the check function. Don't know if this is correct.
 
2. When it is called 
 a) The database locks on EINK, EKPO etc are not released (strange !!!)
 b) sometimes 2 RELEASESTEPCREATED are triggered.
 
Any ideas or tips ??
 
Thanks
Manish


_______________________________________________
SAP-WUG mailing list
SAP-WUG at mit.edu
http://mailman.mit.edu/mailman/listinfo/sap-wug

_______________________________________________
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/20051010/24961845/attachment.htm


More information about the SAP-WUG mailing list