<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=us-ascii">
<META content="MSHTML 6.00.2800.1458" name=GENERATOR></HEAD>
<BODY>
<DIV dir=ltr align=left><SPAN class=254245322-10102005><FONT face=Arial 
color=#0000ff size=2>Moreover, One more thing I found that If there is no active 
receiver the check FM is not called.</FONT></SPAN></DIV><BR>
<DIV class=OutlookMessageHeader lang=en-us dir=ltr align=left>
<HR tabIndex=-1>
<FONT face=Tahoma size=2><B>From:</B> sap-wug-bounces@mit.edu 
[mailto:sap-wug-bounces@mit.edu] <B>On Behalf Of </B>Khanna, 
Manish<BR><B>Sent:</B> Monday, October 10, 2005 3:46 PM<BR><B>To:</B> SAP 
Workflow Users' Group<BR><B>Subject:</B> RE: Checkfunction in 
SWEC/SWEINST<BR></FONT><BR></DIV>
<DIV></DIV>
<DIV dir=ltr align=left><SPAN class=262173822-10102005><FONT face=Arial 
color=#0000ff size=2>Hi Ramki,</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=262173822-10102005><FONT face=Arial 
color=#0000ff size=2></FONT></SPAN>&nbsp;</DIV>
<DIV dir=ltr align=left><SPAN class=262173822-10102005><FONT face=Arial 
color=#0000ff size=2>I'm using the following logic.</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=262173822-10102005><FONT face=Arial 
color=#0000ff size=2></FONT></SPAN>&nbsp;</DIV>
<DIV dir=ltr align=left><SPAN class=262173822-10102005><FONT face=Arial 
color=#0000ff size=2>1. Capture the change event.</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=262173822-10102005><FONT face=Arial 
color=#0000ff size=2>2.&nbsp;Check if there are any receivers. 
</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=262173822-10102005><FONT face=Arial 
color=#0000ff size=2>3. If there is at least 1 , it shows there is an approval 
workflow 'In Process' for the document. Do nothing</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=262173822-10102005><FONT face=Arial 
color=#0000ff size=2>4. If there are 0 receivers, it means the document was 
changed in release state. Trigger a new workflow. </FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=262173822-10102005><FONT face=Arial 
color=#0000ff size=2></FONT></SPAN>&nbsp;</DIV>
<DIV dir=ltr align=left><SPAN class=262173822-10102005><FONT face=Arial 
color=#0000ff size=2>I'm using the FM in SWEINST. </FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=262173822-10102005><FONT face=Arial 
color=#0000ff size=2></FONT></SPAN>&nbsp;</DIV>
<DIV dir=ltr align=left><SPAN class=262173822-10102005><FONT face=Arial 
color=#0000ff size=2>Thanks</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=262173822-10102005><FONT face=Arial 
color=#0000ff size=2>Manish</FONT></SPAN></DIV><BR>
<DIV class=OutlookMessageHeader lang=en-us dir=ltr align=left>
<HR tabIndex=-1>
<FONT face=Tahoma size=2><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> Monday, October 10, 2005 1:13 
PM<BR><B>To:</B> sap-wug@mit.edu<BR><B>Subject:</B> Re: Checkfunction in 
SWEC/SWEINST<BR></FONT><BR></DIV>
<DIV></DIV>
<DIV style="FONT-SIZE: 10pt; FONT-FAMILY: 'Verdana'">
<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 {
        FONT-SIZE: 12px; MARGIN: 0px; COLOR: #000; FONT-FAMILY: Tahoma, Verdana, Arial, Sans-Serif; BACKGROUND-COLOR: #fff
}
.AOLPlainTextBody PRE {
        FONT-SIZE: 9pt
}
.AOLInlineAttachment {
        MARGIN: 10px
}
.AOLAttachmentHeader {
        BACKGROUND: #f9f9f9; BORDER-BOTTOM: #e9eaeb 2px solid
}
.AOLAttachmentHeader .Title {
        PADDING-RIGHT: 0px; PADDING-LEFT: 10px; BACKGROUND: #e9eaeb; PADDING-BOTTOM: 1px; FONT: bold 11px Tahoma; COLOR: #666666; PADDING-TOP: 3px
}
.AOLAttachmentHeader .FieldLabel {
        PADDING-RIGHT: 10px; PADDING-LEFT: 9px; PADDING-BOTTOM: 1px; FONT: bold 11px Tahoma; COLOR: #666666; PADDING-TOP: 1px
}
.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>