Checkfunction in SWEC/SWEINST

Khanna, Manish manish.khanna at amd.com
Mon Oct 10 18:54:16 EDT 2005


Moreover, One more thing I found that If there is no active receiver the
check FM is not called.

________________________________

From: sap-wug-bounces at mit.edu [mailto:sap-wug-bounces at mit.edu] On Behalf
Of Khanna, Manish
Sent: Monday, October 10, 2005 3:46 PM
To: SAP Workflow Users' Group
Subject: RE: Checkfunction in SWEC/SWEINST


Hi Ramki,
 
I'm using the following logic.
 
1. Capture the change event.
2. Check if there are any receivers. 
3. If there is at least 1 , it shows there is an approval workflow 'In
Process' for the document. Do nothing
4. If there are 0 receivers, it means the document was changed in
release state. Trigger a new workflow. 
 
I'm using the FM in SWEINST. 
 
Thanks
Manish

________________________________

From: sap-wug-bounces at mit.edu [mailto:sap-wug-bounces at mit.edu] On Behalf
Of workflow99 at aol.com
Sent: Monday, October 10, 2005 1:13 PM
To: sap-wug at mit.edu
Subject: Re: Checkfunction in SWEC/SWEINST


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 <mailto:SAP-WUG%40mit.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/026c3f8f/attachment.htm


More information about the SAP-WUG mailing list