PO WF triggers twice ?JUNK MAIL? 4

Khanna, Manish manish.khanna at amd.com
Tue Nov 15 21:50:20 EST 2005


Hi Mike,

There are no explicit commits. It is in the code of standard FM
SWW_WI_START.

I'm working on a solution to start purchasing workflows on
"change"(change to qty field as price field is disabled) of consignment
documents. Since consignment docs cannot have release strategy hence the
change was captured in a check FM in SWEC.

All is running well. Any change to a purchasing doc is captured where I
filter out as per my requirement. Once OK I start respective WF for
objtype BUS2012/BUS2013/BUS2014.

In SWW_WI_START I found that it triggers the WF twice. Further debugging
revealed that SWP_WORKFLOW_INSTANCE_CREATE creates one WF whereas the
other is triggered by event creation once the commit happens.

Now exactly where the event data is generated and why I'm not sure.

Thanks
Manish

-----Original Message-----
From: sap-wug-bounces at mit.edu [mailto:sap-wug-bounces at mit.edu] On Behalf
Of Mike Pokraka
Sent: Tuesday, November 15, 2005 4:33 PM
To: SAP Workflow Users' Group
Subject: RE: PO WF triggers twice ?JUNK MAIL? 4

Hi Manish,
The check function is called in the LUW which raised the event. Thus
introducing a commit work (by using SWW_WI_START) will commit the
calling function, which obviously contained something to trigger the
extra event.

Using commits in this way is generally not a good idea, you can cause
havoc if e.g. the caller decides to roll back later in the program then
half your data is already in the DB because you've introduced a commit
in the middle of the LUW. Oops.

Use events, let us know what the issues were? As a matter of interest,
why trigger a WF from a check function?

Cheers
Mike

Khanna, Manish wrote:
> Apologies for the typo error.
>
> The code is written in a check FM that starts WF for PO and SA 
> conditionally. We have custom WF for our requirement.
>
> Event triggering did not work in that check FM (bcoz of update task
> issue) that is why I'm using the SWW_WI_START FM to start purchasing 
> workflows.
>
> I debug the code of SWW_WI_START and found the following..
> 1. It goes to SWW_WI_START->SWW_FI_START->SWW_FI_CREATE
> 2. In SWW_FI_CREATE, the code creats an entry in SWWWIHEAD. Till this 
> point there is only 1 WF.
> 3. In the end of SWW_FI_CREATE there is SWW_WI_LOG_WRITE_SUCCESS.. 
> Which has comit work deep inside.. The moment this comit work is 
> fired, a second workflow is triggered + event 
> BUS2012-releasestepcreated is also triggered.
>
> Now I'm confused from where this 2nd WF is triggered.
>
> WF trace does not show anything and so does SWEL.
>
> Thanks
> Manish
>
> -----Original Message-----
> From: sap-wug-bounces at mit.edu [mailto:sap-wug-bounces at mit.edu] On 
> Behalf Of Mike Pokraka
> Sent: Tuesday, November 15, 2005 11:48 AM
> To: SAP Workflow Users' Group
> Subject: Re: PO WF triggers twice
>
> Hi Manish,
> Assuming you use SWW_WI_START (why?) to start a workflow not a PO, 
> which workflow and what steps does it execute when you get the event?
> Mike Pokraka
> Senior Consultant
> Workflow Connections Ltd.
> Mobile: +44 (0)7786 910 855
>
> Khanna, Manish wrote:
>> Hi,
>>
>> Following are the SWEC entries.
>>
>> EINKBELEG     BUS2012                 CHANGED
>> EINKBELEG     QCYBUS2012          CREATED
>> EINKBELEG     BUS2011                 QUOTATIONCREATED
>> EINKBELEG     BUS2010                 RFQUPDATED
>> EINKBELEG     BUS2012                 CUSTCHANGED
>> EINKBELEG     BUS2013                 CUSTCHANGED
>> EINKBELEG     BUS2014                 CUSTCHANGED
>> EINKBELEG     FREBUS2012           CREATED
>> EINKBELEG
>>
>>
>> However when I start a PO using SWW_WI_START. Now this should start 
>> the WF directly. However the moment this executes it fires BUS2012 
>> 'RELEASESTEPCREATED' . As a result, 2 WF are triggered, one thru 
>> SWW_WI_START and another through the event.
>>
>> Dont know why this happens :(
>>
>> Thanks
>> Manish
>> _______________________________________________
>> SAP-WUG mailing list
>> SAP-WUG at mit.edu
>> http://mailman.mit.edu/mailman/listinfo/sap-wug
>>
>
> _______________________________________________
> SAP-WUG mailing list
> SAP-WUG at mit.edu
> http://mailman.mit.edu/mailman/listinfo/sap-wug
>
>
>
> _______________________________________________
> SAP-WUG mailing list
> SAP-WUG at mit.edu
> http://mailman.mit.edu/mailman/listinfo/sap-wug
>

_______________________________________________
SAP-WUG mailing list
SAP-WUG at mit.edu
http://mailman.mit.edu/mailman/listinfo/sap-wug





More information about the SAP-WUG mailing list