How to know if a workflow instance have already been executed

Kjetil Kilhavn KJETILK at statoil.com
Mon Jun 20 02:42:02 EDT 2005


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.
 
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.
-- 
Kjetil Kilhavn, Statoil KTJ IT BKS
 


________________________________

From: sap-wug-bounces at mit.edu [mailto:sap-wug-bounces at mit.edu] On Behalf
Of Cristiana D'Agosto
Sent: 20. juni 2005 01:49
To: SAP Workflow Users' Group
Subject: RE: How to know if a workflow instance have already been
executed
Importance: High



Hi Kjetil, 

you are correct, my pseudo-code is actually like this: 

1 - bus2081.completedtorelease 
2 - Receiver FM is called 
3 - Within FM: 
if withholding tax is applicable then 
------ if withholding tax approval workflow has not been executed for
this invoice then
-------------- start withholding tax approval workflow
-------else 
-------------- start release for posting approval worlflow  
------ end if 
else 
-------- start release for posting approval workflow 
end if 

It realy seems to be a timing issue. When I use SWUE to test it, it
works fine. 

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. 

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.   
Any other ideas??? 

Much thanks,

Cristiana
_________________________________
Cristiana d'Agosto
IBM Business Consulting Services
Mobile:  +61 417 927 224
cristiana.dagosto at au1.ibm.com 



"Kjetil Kilhavn" <KJETILK at statoil.com> 
Sent by: sap-wug-bounces at mit.edu 

16/06/2005 04:38 PM 
Please respond to
"SAP Workflow Users' Group"


To
"SAP Workflow Users' Group" <sap-wug at mit.edu> 
cc
Subject
RE: How to know if a workflow instance have already been executed

	




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 
------ if withholding tax approval workflow has not been executed for
this invoice or it is not set to completed nor to started then 
-------------- start release for posting approval worlflow 
-------else 
-------------- start withholding tax approval workflow 
  
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. 
  
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. 
-- 
Kjetil Kilhavn, Statoil KTJ IT BKS 
  


________________________________

From: sap-wug-bounces at mit.edu [mailto:sap-wug-bounces at mit.edu] On Behalf
Of Cristiana D'Agosto
Sent: 16. juni 2005 03:26
To: SAP Workflow Users' Group
Subject: How to know if a workflow instance have already been executed


4.7 

>From MIR7, upon selecting button Save as Completed, obj type/event
bus2081.completedtorelease is published. 

In my client, this event can start more than one customized workflows:
withholding tax approval and release for posting workflow. 

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. 

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. 

I need to control that workflow for withholding tax approval does not
start again. 

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). 

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. 

The client would like to have the users always using button Save as
Completed. 

1 - bus2081.completedtorelease 
2 - Receiver FM is called 
3 - Within FM: 
if withholding tax is applicable then 
------ if withholding tax approval workflow has not been executed for
this invoice or it is not set to completed nor to started then 
-------------- start release for posting approval worlflow 
-------else 
-------------- start withholding tax approval workflow 
------ end if 
else 
-------- start release for posting approval workflow 
end if 

Any ideas on how to achieve what I need? 

Much thanks for any help!

Regards, 

Cristiana
_________________________________
Cristiana d'Agosto
IBM Business Consulting Services
Mobile:  +61 417 927 224
cristiana.dagosto at au1.ibm.com 

-------------------------------------------------------------------
The information contained in this message may be CONFIDENTIAL and is
intended for the addressee only. Any unauthorised use, dissemination of
the
information or copying of this message is prohibited. If you are not the
addressee, please notify the sender immediately by return e-mail and
delete
this message.
Thank you._______________________________________________
SAP-WUG mailing list
SAP-WUG at mit.edu
http://mailman.mit.edu/mailman/listinfo/sap-wug




-------------------------------------------------------------------
The information contained in this message may be CONFIDENTIAL and is
intended for the addressee only. Any unauthorised use, dissemination of the
information or copying of this message is prohibited. If you are not the
addressee, please notify the sender immediately by return e-mail and delete
this message.
Thank you.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.mit.edu/pipermail/sap-wug/attachments/20050620/a2ba08a3/attachment.htm


More information about the SAP-WUG mailing list