<br><font size=2 face="sans-serif">Hi Kjetil,</font>
<br>
<br><font size=2 face="sans-serif">you are correct, my pseudo-code is actually
like this:</font>
<br>
<br><font size=2 face="sans-serif">1 - bus2081.completedtorelease <br>
2 - Receiver FM is called</font><font size=3> </font><font size=2 face="sans-serif"><br>
3 - Within FM: <br>
if withholding tax is applicable then</font><font size=3> </font><font size=2 face="sans-serif"><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 size=2 face="sans-serif"><br>
-------------- start release for posting approval worlflow</font><font size=3>
&nbsp;</font><font size=2 face="sans-serif"><br>
------ end if</font><font size=3> </font><font size=2 face="sans-serif"><br>
else</font><font size=3> </font><font size=2 face="sans-serif"><br>
-------- start release for posting approval workflow</font><font size=3>
</font><font size=2 face="sans-serif"><br>
end if </font>
<br>
<br><font size=2 face="sans-serif">It realy seems to be a timing issue.
When I use SWUE to test it, it works fine.</font>
<br>
<br><font size=2 face="sans-serif">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 size=2 face="sans-serif">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 size=2 face="sans-serif">Any other ideas???</font>
<br>
<br><font size=2 face="sans-serif">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%>
<tr valign=top>
<td width=40%><font size=1 face="sans-serif"><b>&quot;Kjetil Kilhavn&quot;
&lt;KJETILK@statoil.com&gt;</b> </font>
<br><font size=1 face="sans-serif">Sent by: sap-wug-bounces@mit.edu</font>
<p><font size=1 face="sans-serif">16/06/2005 04:38 PM</font>
<table border>
<tr valign=top>
<td bgcolor=white>
<div align=center><font size=1 face="sans-serif">Please respond to<br>
&quot;SAP Workflow Users' Group&quot;</font></div></table>
<br>
<td width=59%>
<table width=100%>
<tr>
<td>
<div align=right><font size=1 face="sans-serif">To</font></div>
<td valign=top><font size=1 face="sans-serif">&quot;SAP Workflow Users'
Group&quot; &lt;sap-wug@mit.edu&gt;</font>
<tr>
<td>
<div align=right><font size=1 face="sans-serif">cc</font></div>
<td valign=top>
<tr>
<td>
<div align=right><font size=1 face="sans-serif">Subject</font></div>
<td valign=top><font size=1 face="sans-serif">RE: How to know if a workflow
instance have already been executed</font></table>
<br>
<table>
<tr valign=top>
<td>
<td></table>
<br></table>
<br>
<br>
<br><font size=2 face="Arial">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 size=2 color=blue face="Arial">------ 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=2 color=blue face="sans-serif"><br>
-------------- start release for posting approval worlflow</font><font size=2 color=blue face="Arial">
</font><font size=2 color=blue face="sans-serif"><br>
-------else</font><font size=2 color=blue face="Arial"> </font><font size=2 color=blue face="sans-serif"><br>
-------------- start withholding tax approval workflow</font><font size=2 color=blue face="Arial">
</font>
<br><font size=2 color=blue face="Arial">&nbsp;</font>
<br><font size=2 face="Arial">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 size=2 face="Arial">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 size=2 color=blue face="Arial">-- </font>
<br><font size=2 face="Arial">Kjetil Kilhavn, Statoil KTJ IT BKS</font>
<br><font size=3>&nbsp;</font>
<br>
<br>
<hr><font size=2 face="Tahoma"><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 size=2 face="sans-serif"><br>
4.7</font><font size=3> <br>
</font><font size=2 face="sans-serif"><br>
>From MIR7, upon selecting button Save as Completed, obj type/event bus2081.completedtorelease
is published.</font><font size=3> <br>
</font><font size=2 face="sans-serif"><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 size=2 face="sans-serif"><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 size=2 face="sans-serif"><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 size=2 face="sans-serif"><br>
I need to control that workflow for withholding tax approval does not start
again.</font><font size=3> <br>
</font><font size=2 face="sans-serif"><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 size=2 face="sans-serif"><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 size=2 face="sans-serif"><br>
The client would like to have the users always using button Save as Completed.</font><font size=3>
<br>
</font><font size=2 face="sans-serif"><br>
1 - bus2081.completedtorelease <br>
2 - Receiver FM is called</font><font size=3> </font><font size=2 face="sans-serif"><br>
3 - Within FM: <br>
if withholding tax is applicable then</font><font size=3> </font><font size=2 face="sans-serif"><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 size=2 face="sans-serif"><br>
-------------- start release for posting approval worlflow</font><font size=3>
</font><font size=2 face="sans-serif"><br>
-------else</font><font size=3> </font><font size=2 face="sans-serif"><br>
-------------- start withholding tax approval workflow</font><font size=3>
</font><font size=2 face="sans-serif"><br>
------ end if</font><font size=3> </font><font size=2 face="sans-serif"><br>
else</font><font size=3> </font><font size=2 face="sans-serif"><br>
-------- start release for posting approval workflow</font><font size=3>
</font><font size=2 face="sans-serif"><br>
end if</font><font size=3> <br>
</font><font size=2 face="sans-serif"><br>
Any ideas on how to achieve what I need? </font><font size=3><br>
</font><font size=2 face="sans-serif"><br>
Much thanks for any help!</font><font size=3><br>
</font><font size=2 face="sans-serif"><br>
Regards,</font><font size=3> </font><font size=2 face="sans-serif"><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 size=2 face="Arial">_______________________________________________<br>
SAP-WUG mailing list<br>
SAP-WUG@mit.edu<br>
http://mailman.mit.edu/mailman/listinfo/sap-wug<br>
</font>
<p>