<!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.2900.2627" name=GENERATOR></HEAD>
<BODY>
<DIV dir=ltr align=left><SPAN class=851233706-20062005><FONT face=Arial 
color=#0000ff size=2>It isn't a real solution, but perhaps you could publish the 
event at the end of your withholding tax workflow (after receiving the 
terminating event). I suppose you should add some logic to verify that the 
posting approval workflow isn't already running since you may pick up two 
events.</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=851233706-20062005><FONT face=Arial 
color=#0000ff size=2></FONT></SPAN>&nbsp;</DIV>
<DIV dir=ltr align=left><SPAN class=851233706-20062005><FONT face=Arial 
color=#0000ff size=2>When you say you tried using the event queue, I assume you 
did mark your linkage to use the event queue. It isn't sufficient to turn the 
queue on, each linkage must be marked. I am a bit surprised that it didn't 
help.</FONT></SPAN></DIV>
<DIV align=left><FONT face=Arial size=2>-- </FONT></DIV>
<DIV align=left><FONT face=Arial size=2>Kjetil Kilhavn, Statoil KTJ IT 
BKS</FONT></DIV>
<DIV><FONT face=Arial color=#0000ff size=2></FONT>&nbsp;</DIV><FONT face=Arial 
size=2></FONT><FONT face=Arial size=2></FONT><FONT face=Arial 
size=2></FONT><FONT face=Arial size=2></FONT><FONT face=Arial 
size=2></FONT><FONT face=Arial size=2></FONT><FONT face=Arial 
size=2></FONT><FONT face=Arial size=2></FONT><FONT face=Arial 
size=2></FONT><FONT face=Arial size=2></FONT><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>Cristiana 
D'Agosto<BR><B>Sent:</B> 20. juni 2005 01:49<BR><B>To:</B> SAP Workflow Users' 
Group<BR><B>Subject:</B> RE: How to know if a workflow instance have already 
been executed<BR><B>Importance:</B> High<BR></FONT><BR></DIV>
<DIV></DIV><FONT face=Arial color=#0000ff size=2></FONT><FONT face=Arial 
color=#0000ff size=2></FONT><FONT face=Arial color=#0000ff size=2></FONT><FONT 
face=Arial color=#0000ff size=2></FONT><FONT face=Arial color=#0000ff 
size=2></FONT><FONT face=Arial color=#0000ff size=2></FONT><FONT face=Arial 
color=#0000ff size=2></FONT><FONT face=Arial color=#0000ff 
size=2></FONT><BR><FONT face=sans-serif size=2>Hi Kjetil,</FONT> <BR><BR><FONT 
face=sans-serif size=2>you are correct, my pseudo-code is actually like 
this:</FONT> <BR><BR><FONT face=sans-serif size=2>1 - bus2081.completedtorelease 
<BR>2 - Receiver FM is called</FONT><FONT size=3> </FONT><FONT face=sans-serif 
size=2><BR>3 - Within FM: <BR>if withholding tax is applicable then</FONT><FONT 
size=3> </FONT><FONT face=sans-serif size=2><BR>------ if withholding tax 
approval workflow has not been executed for this invoice then<BR>-------------- 
start withholding tax approval workflow<BR>-------else</FONT><FONT size=3> 
</FONT><FONT face=sans-serif size=2><BR>-------------- start release for posting 
approval worlflow</FONT><FONT size=3> &nbsp;</FONT><FONT face=sans-serif 
size=2><BR>------ end if</FONT><FONT size=3> </FONT><FONT face=sans-serif 
size=2><BR>else</FONT><FONT size=3> </FONT><FONT face=sans-serif 
size=2><BR>-------- start release for posting approval workflow</FONT><FONT 
size=3> </FONT><FONT face=sans-serif size=2><BR>end if </FONT><BR><BR><FONT 
face=sans-serif size=2>It realy seems to be a timing issue. When I use SWUE to 
test it, it works fine.</FONT> <BR><BR><FONT face=sans-serif size=2>I guess the 
problem is that the last step of the withholding tax approval worklow is an 
asynchronous task. In the last step, the AP guys complete the withholding tax 
details in the invoice and then press the Save as Complete button. When this 
happens, the event completedchanged is raised and the workflow is completed 
(completedchanged is a terminating event for the last task of the withholding 
tax approval workflow); then the event completedtorelease is raised but it does 
not trigger my next workflow, actually, looking at the event trace log, the name 
of the receiver type is () - it doesn't start any workflows whatsoever.</FONT> 
<BR><BR><FONT face=sans-serif size=2>There is anything I could do to delay the 
completedtorelease event being published so quickly? I tried using the event 
queue, but the same problem happens. &nbsp;</FONT> <BR><FONT face=sans-serif 
size=2>Any other ideas???</FONT> <BR><BR><FONT face=sans-serif size=2>Much 
thanks,<BR><BR>Cristiana<BR>_________________________________<BR>Cristiana 
d'Agosto<BR>IBM Business Consulting Services<BR>Mobile: &nbsp;+61 417 927 
224<BR>cristiana.dagosto@au1.ibm.com</FONT> <BR><BR><BR>
<TABLE width="100%">
  <TBODY>
  <TR vAlign=top>
    <TD width="40%"><FONT face=sans-serif size=1><B>"Kjetil Kilhavn" 
      &lt;KJETILK@statoil.com&gt;</B> </FONT><BR><FONT face=sans-serif 
      size=1>Sent by: sap-wug-bounces@mit.edu</FONT> 
      <P><FONT face=sans-serif size=1>16/06/2005 04:38 PM</FONT> 
      <TABLE border=1>
        <TBODY>
        <TR vAlign=top>
          <TD bgColor=white>
            <DIV align=center><FONT face=sans-serif size=1>Please respond 
            to<BR>"SAP Workflow Users' 
Group"</FONT></DIV></TR></TBODY></TABLE><BR></P>
    <TD width="59%">
      <TABLE width="100%">
        <TBODY>
        <TR>
          <TD>
            <DIV align=right><FONT face=sans-serif size=1>To</FONT></DIV>
          <TD vAlign=top><FONT face=sans-serif size=1>"SAP Workflow Users' 
            Group" &lt;sap-wug@mit.edu&gt;</FONT> 
        <TR>
          <TD>
            <DIV align=right><FONT face=sans-serif size=1>cc</FONT></DIV>
          <TD vAlign=top>
        <TR>
          <TD>
            <DIV align=right><FONT face=sans-serif size=1>Subject</FONT></DIV>
          <TD vAlign=top><FONT face=sans-serif size=1>RE: How to know if a 
            workflow instance have already been 
      executed</FONT></TR></TBODY></TABLE><BR>
      <TABLE>
        <TBODY>
        <TR vAlign=top>
          <TD>
          <TD></TR></TBODY></TABLE><BR></TR></TBODY></TABLE><BR><BR><BR><FONT face=Arial 
size=2>In your pseudocode you have a bug as far as I can see, but I suppose that 
doesn't apply to the real code. You state that if the withholding tax approval 
has been executed you should start the withholding tax approval</FONT> <BR><FONT 
face=Arial color=blue size=2>------ if withholding tax approval workflow has not 
been executed for this invoice or it is not set to completed nor to started then 
</FONT><FONT face=sans-serif color=blue size=2><BR>-------------- start release 
for posting approval worlflow</FONT><FONT face=Arial color=blue size=2> 
</FONT><FONT face=sans-serif color=blue size=2><BR>-------else</FONT><FONT 
face=Arial color=blue size=2> </FONT><FONT face=sans-serif color=blue 
size=2><BR>-------------- start withholding tax approval workflow</FONT><FONT 
face=Arial color=blue size=2> </FONT><BR><FONT face=Arial color=blue 
size=2>&nbsp;</FONT> <BR><FONT face=Arial size=2>Perhaps you should just check 
that the workflow is not cancelled? If it is the type W item you check it can be 
selected (reserved) as well, and committed if confirmation of completion is 
required. It can of course also be in error or cancelled. If it is the type F 
item you check I suppose completed and ready should cover what you want.</FONT> 
<BR><FONT size=3>&nbsp;</FONT> <BR><FONT face=Arial size=2>You can usually check 
if there is a timing issue by debugging. If it works when you are debugging and 
doesn't work otherwise it is most likely a timing issue. Otherwise you should 
dump the information you find about the work items to see what statuses are 
reported.</FONT> <BR><FONT face=Arial color=blue size=2>-- </FONT><BR><FONT 
face=Arial size=2>Kjetil Kilhavn, Statoil KTJ IT BKS</FONT> <BR><FONT 
size=3>&nbsp;</FONT> <BR><BR>
<HR>
<FONT face=Tahoma size=2><B>From:</B> sap-wug-bounces@mit.edu 
[mailto:sap-wug-bounces@mit.edu] <B>On Behalf Of </B>Cristiana 
D'Agosto<B><BR>Sent:</B> 16. juni 2005 03:26<B><BR>To:</B> SAP Workflow Users' 
Group<B><BR>Subject:</B> How to know if a workflow instance have already been 
executed</FONT><FONT size=3><BR></FONT><BR><FONT face=sans-serif 
size=2><BR>4.7</FONT><FONT size=3> <BR></FONT><FONT face=sans-serif 
size=2><BR>&gt;From MIR7, upon selecting button Save as Completed, obj 
type/event bus2081.completedtorelease is published.</FONT><FONT size=3> 
<BR></FONT><FONT face=sans-serif size=2><BR>In my client, this event can start 
more than one customized workflows: withholding tax approval and release for 
posting workflow.</FONT><FONT size=3> <BR></FONT><FONT face=sans-serif 
size=2><BR>I have a receiver FM that is testing if the withholding tax approval 
workflow should start (based on Vendor master data); if it doesnt then the 
release for posting workflow starts.</FONT><FONT size=3> <BR></FONT><FONT 
face=sans-serif size=2><BR>Withholding tax approval wf : goes to the agent to 
enter details on regards to withholding tax and then goes to AP. The AP guys 
then enter whatever they have to in the invoice and click Save as Completed - 
bus2081.completedtorelease is published and bus2081.completedtoreleased is 
published.</FONT><FONT size=3> <BR></FONT><FONT face=sans-serif size=2><BR>I 
need to control that workflow for withholding tax approval does not start 
again.</FONT><FONT size=3> <BR></FONT><FONT face=sans-serif size=2><BR>How in my 
receiver FM can I check if the withholding tax approval workflow has been 
completed or it is being processed ? The withholding tax approval should only 
start once (if applicable, depends on vendor master data).</FONT><FONT size=3> 
<BR></FONT><FONT face=sans-serif size=2><BR>If the vendor in the invoice is 
subject to withholding tax, I am using FM SWI_WORKITEMS_OF_OBJECT_GET to 
retrieve all the workflows that have started for my objkey and then checking if 
there is any instance of the withholding tax approval that is set to either 
'completed' or 'started' - but I think the events happen too fast and table 
swwwihead doesn't get update on time.</FONT><FONT size=3> <BR></FONT><FONT 
face=sans-serif size=2><BR>The client would like to have the users always using 
button Save as Completed.</FONT><FONT size=3> <BR></FONT><FONT face=sans-serif 
size=2><BR>1 - bus2081.completedtorelease <BR>2 - Receiver FM is 
called</FONT><FONT size=3> </FONT><FONT face=sans-serif size=2><BR>3 - Within 
FM: <BR>if withholding tax is applicable then</FONT><FONT size=3> </FONT><FONT 
face=sans-serif size=2><BR>------ if withholding tax approval workflow has not 
been executed for this invoice or it is not set to completed nor to started 
then</FONT><FONT size=3> </FONT><FONT face=sans-serif size=2><BR>-------------- 
start release for posting approval worlflow</FONT><FONT size=3> </FONT><FONT 
face=sans-serif size=2><BR>-------else</FONT><FONT size=3> </FONT><FONT 
face=sans-serif size=2><BR>-------------- start withholding tax approval 
workflow</FONT><FONT size=3> </FONT><FONT face=sans-serif size=2><BR>------ end 
if</FONT><FONT size=3> </FONT><FONT face=sans-serif size=2><BR>else</FONT><FONT 
size=3> </FONT><FONT face=sans-serif size=2><BR>-------- start release for 
posting approval workflow</FONT><FONT size=3> </FONT><FONT face=sans-serif 
size=2><BR>end if</FONT><FONT size=3> <BR></FONT><FONT face=sans-serif 
size=2><BR>Any ideas on how to achieve what I need? </FONT><FONT 
size=3><BR></FONT><FONT face=sans-serif size=2><BR>Much thanks for any 
help!</FONT><FONT size=3><BR></FONT><FONT face=sans-serif 
size=2><BR>Regards,</FONT><FONT size=3> </FONT><FONT face=sans-serif 
size=2><BR><BR>Cristiana<BR>_________________________________<BR>Cristiana 
d'Agosto<BR>IBM Business Consulting Services<BR>Mobile: &nbsp;+61 417 927 
224<BR>cristiana.dagosto@au1.ibm.com</FONT> 
<P><FONT 
size=1>-------------------------------------------------------------------<BR>The 
information contained in this message may be CONFIDENTIAL and is<BR>intended for 
the addressee only. Any unauthorised use, dissemination of the<BR>information or 
copying of this message is prohibited. If you are not the<BR>addressee, please 
notify the sender immediately by return e-mail and delete<BR>this 
message.<BR>Thank you.</FONT><FONT face=Arial 
size=2>_______________________________________________<BR>SAP-WUG mailing 
list<BR>SAP-WUG@mit.edu<BR>http://mailman.mit.edu/mailman/listinfo/sap-wug<BR></FONT>
<P></P><p></p><p><font size=1>-------------------------------------------------------------------<br>The information contained in this message may be CONFIDENTIAL and is<br>intended for the addressee only. Any unauthorised use, dissemination of the<br>information or copying of this message is prohibited. If you are not the<br>addressee, please notify the sender immediately by return e-mail and delete<br>this message.<br>Thank you.</font size></BODY></HTML>