<!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=695372206-16062005><FONT face=Arial 
color=#0000ff size=2>
<DIV dir=ltr align=left><SPAN class=695372206-16062005><FONT face=Arial 
color=#000000 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></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=695372206-16062005><FONT face=Arial 
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> <BR><FONT 
face=sans-serif size=2>-------------- start release for posting approval 
worlflow</FONT> <BR><FONT face=sans-serif size=2>-------else</FONT> <BR><FONT 
face=sans-serif size=2>-------------- start withholding tax approval 
workflow</FONT> <BR></SPAN></DIV>
<DIV align=left><FONT face=Arial color=#000000 
size=2></FONT>&nbsp;</DIV></FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=695372206-16062005><FONT face=Arial 
size=2>Perhaps you should just check that the workflow is not cancelled? If it 
is the&nbsp;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></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=695372206-16062005><FONT face=Arial 
size=2></FONT></SPAN>&nbsp;</DIV>
<DIV dir=ltr align=left><SPAN class=695372206-16062005><FONT face=Arial 
size=2>You can usually check if there is&nbsp;a timing issue by debugging. If it 
works when you are debugging and doesn't work otherwise it is most likely a 
timing issue.&nbsp;Otherwise you should dump the information you find about the 
work items to see what statuses are reported.</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=695372206-16062005><FONT face=Arial 
color=#0000ff size=2>-- </FONT></SPAN></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><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> 16. juni 2005 03:26<BR><B>To:</B> SAP Workflow Users' 
Group<BR><B>Subject:</B> How to know if a workflow instance have already been 
executed<BR></FONT><BR></DIV>
<DIV></DIV><FONT face=Arial color=#0000ff size=2></FONT><FONT face=Arial 
color=#0000ff size=2></FONT><BR><FONT face=sans-serif size=2>4.7</FONT> 
<BR><BR><FONT face=sans-serif size=2>From MIR7, upon selecting button Save as 
Completed, obj type/event bus2081.completedtorelease is published.</FONT> 
<BR><BR><FONT face=sans-serif size=2>In my client, this event can start more 
than one customized workflows: withholding tax approval and release for posting 
workflow.</FONT> <BR><BR><FONT face=sans-serif size=2>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> <BR><BR><FONT face=sans-serif size=2>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> <BR><BR><FONT face=sans-serif 
size=2>I need to control that workflow for withholding tax approval does not 
start again.</FONT> <BR><BR><FONT face=sans-serif size=2>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> <BR><BR><FONT face=sans-serif 
size=2>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> 
<BR><BR><FONT face=sans-serif size=2>The client would like to have the users 
always using button Save as Completed.</FONT> <BR><BR><FONT face=sans-serif 
size=2>1 - bus2081.completedtorelease </FONT><BR><FONT face=sans-serif size=2>2 
- Receiver FM is called</FONT> <BR><FONT face=sans-serif size=2>3 - Within FM: 
</FONT><BR><FONT face=sans-serif size=2>if withholding tax is applicable 
then</FONT> <BR><FONT face=sans-serif 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> <BR><FONT face=sans-serif size=2>-------------- start 
release for posting approval worlflow</FONT> <BR><FONT face=sans-serif 
size=2>-------else</FONT> <BR><FONT face=sans-serif size=2>-------------- start 
withholding tax approval workflow</FONT> <BR><FONT face=sans-serif size=2>------ 
end if</FONT> <BR><FONT face=sans-serif size=2>else</FONT> <BR><FONT 
face=sans-serif size=2>-------- start release for posting approval 
workflow</FONT> <BR><FONT face=sans-serif size=2>end if</FONT> <BR><BR><FONT 
face=sans-serif size=2>Any ideas on how to achieve what I need? 
</FONT><BR><BR><FONT face=sans-serif size=2>Much thanks for any 
help!<BR></FONT><BR><FONT face=sans-serif size=2>Regards,</FONT> <BR><FONT 
face=sans-serif 
size=2><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></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>