<HTML><BODY><DIV style='font-family: "Verdana"; font-size: 10pt;'><DIV>
<DIV>Manish,</DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face="Verdana, Arial, Helvetica, sans-serif">Where exactly are you using this FM? SWEC or SWETYPV?</FONT></DIV>
<DIV><FONT face="Verdana, Arial, Helvetica, sans-serif">What release are you currently on?</FONT></DIV>
<DIV><FONT face="Verdana, Arial, Helvetica, sans-serif">I&nbsp;don't think&nbsp;FUNCTION 'SWE_EVENT_GET_RECEIVERS' will&nbsp;tell you if there is an active workflow for the object key.&nbsp;Look for appropriate SAP_WAPI_* functions.</FONT></DIV>
<DIV><FONT face="Verdana, Arial, Helvetica, sans-serif">Since you want trigger the event only for specific document types, you need to do&nbsp;a document type check before&nbsp;creating the event.&nbsp;</FONT></DIV>
<DIV><FONT face="Verdana, Arial, Helvetica, sans-serif"></FONT>&nbsp;</DIV>
<DIV>
<DIV><FONT lang=0 face="Verdana, Arial, Helvetica, sans-serif" PTSIZE="10" FAMILY="SANSSERIF">Regards,<BR>Ramki Maley<BR>Workflow Developer, USCBP.<BR>248-613-1287 (C)</FONT></DIV></DIV><FONT face="Verdana, Arial, Helvetica, sans-serif">&nbsp;<BR></FONT>-----Original Message-----<BR>From: Khanna, Manish &lt;manish.khanna@amd.com&gt;<BR>To: SAP Workflow Users' Group &lt;sap-wug@mit.edu&gt;<BR>Sent: Mon, 10 Oct 2005 14:31:17 -0500<BR>Subject: RE: Checkfunction in SWEC/SWEINST<BR><BR>
<STYLE>
.AOLPlainTextBody {
    margin: 0px;
    font-family: Tahoma, Verdana, Arial, Sans-Serif;
    font-size: 12px; 
    color: #000; 
    background-color: #fff; 
}

.AOLPlainTextBody pre {
    font-size: 9pt;
}

.AOLInlineAttachment {
    margin: 10px;
}

.AOLAttachmentHeader {
    border-bottom: 2px solid #E9EAEB;
    background: #F9F9F9;
}

.AOLAttachmentHeader .Title {
    font: 11px Tahoma;
    font-weight: bold;
    color: #666666;
    background: #E9EAEB; 
    padding: 3px 0px 1px 10px;
}

.AOLAttachmentHeader .FieldLabel {
    font: 11px Tahoma; 
    font-weight: bold;
    color: #666666;
    padding: 1px 10px 1px 9px;
}

.AOLAttachmentHeader .FieldValue {
    font: 11px Tahoma; 
    color: #333333;
}

</STYLE>

<DIV id=AOLMsgPart_3_2f5411d2-a329-48df-a1e9-0517e36959f4><FONT size=3>
<DIV dir=ltr><FONT face=Courier size=2><SPAN class=373591418-10102005>Hi Ramki,</SPAN></FONT></DIV>
<DIV dir=ltr><FONT face=Courier size=2><SPAN class=373591418-10102005></SPAN></FONT>&nbsp;</DIV>
<DIV dir=ltr><FONT face=Courier size=2><SPAN class=373591418-10102005>Here is the code I want to put. However I also tested it using SWE_EVENT_CREATE with values hardcoded.</SPAN></FONT></DIV>
<DIV dir=ltr><FONT face=Courier size=2></FONT>&nbsp;</DIV>
<DIV dir=ltr><SPAN class=373591418-10102005><FONT face=Courier size=2>*************************************************</FONT></SPAN></DIV>
<DIV dir=ltr><FONT face=Courier size=2></FONT>&nbsp;</DIV>
<DIV dir=ltr><FONT face=Courier size=2>DATA: EVENT_RECEIVERS LIKE SWELOG OCCURS 2,</FONT></DIV>
<DIV dir=ltr><FONT face=Courier size=2>TOTAL_RECEIVERS TYPE N.</FONT></DIV>
<DIV dir=ltr><FONT face=Courier size=2></FONT>&nbsp;</DIV>
<DIV dir=ltr><FONT face=Courier size=2><SPAN class=373591418-10102005>*check if there are any active recievers. (Since this is a change event we have receivers in our approval workflow, </SPAN></FONT></DIV>
<DIV dir=ltr><FONT face=Courier size=2><SPAN class=373591418-10102005>*to cancel if changed in between). So if no reciever that means no existing WF , trigger 'RELEASESTEPCREATED'.</SPAN></FONT></DIV>
<DIV dir=ltr><FONT face=Courier size=2></FONT>&nbsp;</DIV>
<DIV dir=ltr><FONT face=Courier size=2>CALL FUNCTION 'SWE_EVENT_GET_RECEIVERS'</FONT></DIV>
<DIV dir=ltr><FONT face=Courier size=2>EXPORTING</FONT></DIV>
<DIV dir=ltr><FONT face=Courier size=2>OBJTYPE = OBJTYPE</FONT></DIV>
<DIV dir=ltr><FONT face=Courier size=2>OBJKEY = OBJKEY</FONT></DIV>
<DIV dir=ltr><FONT face=Courier size=2>EVENT = EVENT "AMD_CHANGED</FONT></DIV></FONT><FONT color=#0000ff size=3>
<DIV dir=ltr><FONT face=Courier color=#000000 size=2>* CREATOR = ' '</FONT></DIV>
<DIV dir=ltr><FONT face=Courier color=#000000 size=2>* TAKE_WORKITEM_REQUESTER =</FONT></DIV></FONT><FONT size=3>
<DIV dir=ltr><FONT face=Courier size=2>TABLES</FONT></DIV></FONT><FONT color=#0000ff size=3>
<DIV dir=ltr><FONT face=Courier color=#000000 size=2>* EVENT_CONTAINER =</FONT></DIV></FONT><FONT size=3>
<DIV dir=ltr><FONT face=Courier size=2>EVENT_RECEIVERS = EVENT_RECEIVERS</FONT></DIV></FONT><FONT color=#0000ff size=3>
<DIV dir=ltr><FONT face=Courier color=#000000 size=2>* RECEIVER_INFO =</FONT></DIV>
<DIV dir=ltr><FONT face=Courier color=#000000 size=2>* EXCEPTIONS</FONT></DIV>
<DIV dir=ltr><FONT face=Courier color=#000000 size=2>* OBJTYPE_NOT_FOUND = 1</FONT></DIV>
<DIV dir=ltr><FONT face=Courier color=#000000 size=2>* OTHERS = 2</FONT></DIV></FONT><FONT size=3>
<DIV dir=ltr><FONT face=Courier size=2>.</FONT></DIV>
<DIV dir=ltr><FONT face=Courier size=2>IF SY-SUBRC = 0.</FONT></DIV>
<DIV dir=ltr><FONT face=Courier size=2></FONT>&nbsp;</DIV>
<DIV dir=ltr><FONT face=Courier size=2>DESCRIBE TABLE EVENT_RECEIVERS LINES TOTAL_RECEIVERS.</FONT></DIV>
<DIV dir=ltr><FONT face=Courier size=2></FONT>&nbsp;</DIV>
<DIV dir=ltr><FONT face=Courier size=2>IF TOTAL_RECEIVERS = 0.</FONT></DIV></FONT><FONT size=3>
<DIV dir=ltr><FONT face=Courier></FONT>&nbsp;</DIV>
<DIV dir=ltr><FONT face=Courier size=2>CALL FUNCTION 'SWE_EVENT_CREATE'</FONT></DIV>
<DIV dir=ltr><FONT face=Courier size=2>EXPORTING</FONT></DIV>
<DIV dir=ltr><FONT face=Courier size=2>OBJTYPE = OBJTYPE</FONT></DIV>
<DIV dir=ltr><FONT face=Courier size=2>OBJKEY = OBJKEY</FONT></DIV>
<DIV dir=ltr><FONT face=Courier size=2>EVENT = 'RELEASESTEPCREATED'</FONT></DIV>
<DIV dir=ltr><FONT face=Courier size=2>CREATOR = SY-UNAME</FONT></DIV></FONT><FONT color=#0000ff size=3>
<DIV dir=ltr><FONT face=Courier color=#000000 size=2>* TAKE_WORKITEM_REQUESTER = ' '</FONT></DIV></FONT><FONT size=3>
<DIV dir=ltr><FONT face=Courier><FONT size=2><SPAN class=373591418-10102005>&nbsp; </SPAN>START_WITH_DELAY =&nbsp;<SPAN class=373591418-10102005>'X'</SPAN></FONT></FONT></DIV></FONT><FONT color=#0000ff size=3>
<DIV dir=ltr><FONT face=Courier color=#000000 size=2>* START_RECFB_SYNCHRON = ' '</FONT></DIV>
<DIV dir=ltr><FONT face=Courier color=#000000 size=2>* NO_COMMIT_FOR_QUEUE = ' '</FONT></DIV>
<DIV dir=ltr><FONT face=Courier color=#000000 size=2>* DEBUG_FLAG = ' '</FONT></DIV>
<DIV dir=ltr><FONT face=Courier color=#000000 size=2>* NO_LOGGING = ' '</FONT></DIV>
<DIV dir=ltr><FONT face=Courier color=#000000 size=2>* IDENT =</FONT></DIV>
<DIV dir=ltr><FONT face=Courier color=#000000 size=2>* IMPORTING</FONT></DIV>
<DIV dir=ltr><FONT face=Courier color=#000000 size=2>* EVENT_ID =</FONT></DIV>
<DIV dir=ltr><FONT face=Courier color=#000000 size=2>* TABLES</FONT></DIV>
<DIV dir=ltr><FONT face=Courier color=#000000 size=2>* EVENT_CONTAINER =</FONT></DIV>
<DIV dir=ltr><FONT face=Courier color=#000000 size=2>* EXCEPTIONS</FONT></DIV>
<DIV dir=ltr><FONT face=Courier color=#000000 size=2>* OBJTYPE_NOT_FOUND = 1</FONT></DIV>
<DIV dir=ltr><FONT face=Courier color=#000000 size=2>* OTHERS = 2</FONT></DIV></FONT><FONT size=3>
<DIV dir=ltr><FONT face=Courier size=2>.</FONT></DIV></FONT><FONT color=#0000ff size=3>
<DIV dir=ltr><FONT face=Courier><FONT color=#000000><FONT size=2></FONT></FONT></FONT>&nbsp;</DIV></FONT><FONT size=3>
<DIV dir=ltr><FONT face=Courier size=2>ENDIF.</FONT></DIV>
<DIV dir=ltr><FONT face=Courier size=2>ENDIF.</FONT></DIV></FONT>
<DIV dir=ltr><FONT face=Courier>*<SPAN class=373591418-10102005>**********************************</SPAN></FONT></DIV>
<DIV dir=ltr><FONT face=Courier><SPAN class=373591418-10102005></SPAN></FONT>&nbsp;</DIV>
<DIV dir=ltr><FONT face=Courier><SPAN class=373591418-10102005>Regards</SPAN></FONT></DIV>
<DIV dir=ltr><FONT face=Courier><SPAN class=373591418-10102005>Manish</SPAN></FONT></DIV><BR>
<DIV class=OutlookMessageHeader lang=en-us dir=ltr align=left>
<HR tabIndex=-1>
<FONT face=Tahoma><B>From:</B> sap-wug-bounces@mit.edu [mailto:sap-wug-bounces@mit.edu] <B>On Behalf Of </B>Workflow99@aol.com<BR><B>Sent:</B> Saturday, October 08, 2005 4:21 PM<BR><B>To:</B> sap-wug@mit.edu<BR><B>Subject:</B> Re: Checkfunction in SWEC/SWEINST<BR></FONT><BR></DIV>
<DIV></DIV><FONT id=role_document face=Arial color=#000000>
<DIV>
<DIV>
<DIV>
<DIV>Hi Manish,</DIV>
<DIV>&nbsp;</DIV>
<DIV>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.</DIV>
<DIV>&nbsp;</DIV>
<DIV>2)</DIV>
<DIV>&nbsp; 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. </DIV>
<DIV>&nbsp; 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&nbsp;FM.</DIV>
<DIV>&nbsp;</DIV>
<DIV>Perhaps, I can help more if you can post the code of yor FM.</DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT lang=0 face=Arial PTSIZE="10" FAMILY="SANSSERIF">Regards,<BR>Ramki Maley<BR>Workflow Developer, USCBP.<BR>248-613-1287 (C)</FONT></DIV></DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;</DIV>
<DIV>In a message dated 10/8/2005 3:09:58 PM Eastern Standard Time, manish.khanna@amd.com writes:</DIV>
<BLOCKQUOTE style="PADDING-LEFT: 0px; MARGIN-LEFT: 0px"><FONT style="BACKGROUND-COLOR: transparent" face=Arial color=#000000>
<DIV><SPAN class=323465018-08102005><FONT face=Arial color=#0000ff>Hi,</FONT></SPAN></DIV>
<DIV><SPAN class=323465018-08102005><FONT face=Arial color=#0000ff></FONT></SPAN>&nbsp;</DIV>
<DIV><SPAN class=323465018-08102005><FONT face=Arial color=#0000ff>Now that I have realized that consignment documents cannot have release strategy and our requirement is to trigger an&nbsp;approval workflow when a consignment document is "changed" I thought of the following.</FONT></SPAN></DIV>
<DIV><SPAN class=323465018-08102005><FONT face=Arial color=#0000ff></FONT></SPAN>&nbsp;</DIV>
<DIV><SPAN class=323465018-08102005><FONT face=Arial color=#0000ff>1. Create a check function.</FONT></SPAN></DIV>
<DIV><SPAN class=323465018-08102005><FONT face=Arial color=#0000ff>2. Attach it&nbsp;(in SWEC) &nbsp;to change object EINKBELEG / BUS2013 / On Change / Changed(event in BUS2013)</FONT></SPAN></DIV>
<DIV><SPAN class=323465018-08102005><FONT face=Arial color=#0000ff>3. The check function&nbsp;triggers BUS2013/'RELEASESTEPCREATED' event.</FONT></SPAN></DIV>
<DIV><SPAN class=323465018-08102005><FONT face=Arial color=#0000ff></FONT></SPAN>&nbsp;</DIV>
<DIV><SPAN class=323465018-08102005><FONT face=Arial color=#0000ff>Now this seems to be a solution, but its not working.</FONT></SPAN></DIV>
<DIV><SPAN class=323465018-08102005><FONT face=Arial color=#0000ff></FONT></SPAN>&nbsp;</DIV>
<DIV><SPAN class=323465018-08102005><FONT face=Arial color=#0000ff>Why ?? </FONT></SPAN><SPAN class=323465018-08102005><FONT face=Arial color=#0000ff>Because</FONT></SPAN></DIV>
<DIV><SPAN class=323465018-08102005><FONT face=Arial color=#0000ff>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.</FONT></SPAN></DIV>
<DIV><SPAN class=323465018-08102005><FONT face=Arial color=#0000ff></FONT></SPAN>&nbsp;</DIV>
<DIV><SPAN class=323465018-08102005><FONT face=Arial color=#0000ff>2. When it is called </FONT></SPAN></DIV>
<DIV><SPAN class=323465018-08102005><FONT face=Arial color=#0000ff>&nbsp;a) The database locks on EINK, EKPO etc are not released (strange !!!)</FONT></SPAN></DIV>
<DIV><SPAN class=323465018-08102005><FONT face=Arial color=#0000ff>&nbsp;b) sometimes 2 RELEASESTEPCREATED are triggered.</FONT></SPAN></DIV>
<DIV><SPAN class=323465018-08102005><FONT face=Arial color=#0000ff></FONT></SPAN>&nbsp;</DIV>
<DIV><SPAN class=323465018-08102005><FONT face=Arial color=#0000ff>Any ideas or tips ??</FONT></SPAN></DIV>
<DIV><SPAN class=323465018-08102005><FONT face=Arial color=#0000ff></FONT></SPAN>&nbsp;</DIV>
<DIV><SPAN class=323465018-08102005><FONT face=Arial color=#0000ff>Thanks</FONT></SPAN></DIV>
<DIV><SPAN class=323465018-08102005><FONT face=Arial color=#0000ff>Manish</FONT></SPAN></DIV><BR><BR>_______________________________________________<BR>SAP-WUG mailing list<BR>SAP-WUG@mit.edu<BR>http://mailman.mit.edu/mailman/listinfo/sap-wug<BR></FONT></BLOCKQUOTE></DIV>
<DIV></DIV></DIV></FONT></DIV><!-- end of AOLMsgPart_3_2f5411d2-a329-48df-a1e9-0517e36959f4 -->
<DIV class=AOLPlainTextBody id=AOLMsgPart_4_2f5411d2-a329-48df-a1e9-0517e36959f4><PRE><TT>_______________________________________________
SAP-WUG mailing list
<A href="mailto:SAP-WUG%40mit.edu">SAP-WUG@mit.edu</A>
<A href="http://mailman.mit.edu/mailman/listinfo/sap-wug" target=_blank>http://mailman.mit.edu/mailman/listinfo/sap-wug</A>
</TT></PRE></DIV><!-- end of AOLMsgPart_4_2f5411d2-a329-48df-a1e9-0517e36959f4 --></DIV></DIV></BODY></HTML>