PO WF triggers twice

Mike Pokraka wug.replies at workflowconnections.com
Wed Nov 16 02:01:04 EST 2005


Hi Manish,
Jocelyn has already explained it quite well:
- Create an event ZCONSIGNMENTCHANGED
- Create a SWEC entry with FM to filter out consignment doc types.
- Also in SWEC, restrict it to the fields you're after.

I'd also suggest to put the 'check to see if another WF is running' and
other parts into a check FM or start condition of the triggered WF.
Clearer separation of business logic (it has changed, so raise the event!)
and easier to trace problems.

Cheers
Mike

Khanna, Manish wrote:
> Jocelyn,
>
> As I mentioned what I'm trying to achieve, following seemed to be the
> best option...
>
> 1. capture any change to EINKBELEG
> 2. in checkfm filter out if the document is a consignment doc and there
> is no WF already in process
> 3. if yes reset the release and start the corresponding WF.
>
> I might not be using the checkFM in the correct manner. However I
> couldn't find another alternative.
>
> Let me brief the scenario.
>
> * We have custom BUS2012 with associated approval WF WS90100055.
> * The WF is triggered by BUS2012-RELEASESTEPCREATED.
> * Type Linkage has been defined in SWETYPV
> * SWEC entries can be found bottom of this mail chain
> * Any "change" (to price field) to a standard PO which approval flow is
> "complete" and is now "released", is captured by the system. This change
> triggers BUS2012-RELEASESTEPCREATED that starts a new WF. This happens
> for all PO types except consignment.
> * For consignment PO, the first time its created,
> BUS2012-RELEASESTEPCREATED is triggered. But subsequent changes are not
> recognised by the system. This I understand is because of no release
> strategy for consignment PO. And this is the solution I'm trying to
> implement.
>
> That is why I need to start new WF on change of consignment document.
>
> Hence the issue is not to start an 'alternative WF' but the same one
> that starts for other document types.
>
> Thanks
> Manish
>
> -----Original Message-----
> From: sap-wug-bounces at mit.edu [mailto:sap-wug-bounces at mit.edu] On Behalf
> Of Dart, Jocelyn
> Sent: Wednesday, November 16, 2005 11:20 AM
> To: SAP Workflow Users' Group
> Subject: RE: PO WF triggers twice ?JUNK MAIL? 4 ?JUNK MAIL? 4
>
>
> Mahish,
> Sorry - I didn't notice the comment about raising it in a check function
> module.
>
> You ***really*** shouldn't be using a check function module to start a
> workflow anyway - the sole purpose of the check function module is to
> decide whether or not to start the workflow nominated in the event
> linkage.   You definitely shouldn't be raising commit works in a check
> function module!!!
>
> If you want to start a new workflow or an alternative workflow, you
> either have a second event linkage with its own check function module or
> start condition, and you make sure the two check fms/start conditions
> are mutually exclusive, OR you have one generic event linkage and use
> the receiver type function module to decide which workflow should be
> started.
>
> Using the function module for the wrong purpose could be a significant
> part of your problem.
>
> The fact that the last guy got it wrong is not a good reason for
> perpetuating the problem...
>
> In any case the check function is a technical object - reorganising the
> original event linkage into two event linkages/function modules will not
> impact anyone directly other than the workflow administrator.
>
> Regards,
> Jocelyn Dart
>
> -----Original Message-----
> From: sap-wug-bounces at mit.edu [mailto:sap-wug-bounces at mit.edu] On Behalf
> Of Khanna, Manish
> Sent: Wednesday, 16 November 2005 3:41 PM
> To: SAP Workflow Users' Group
> Subject: RE: PO WF triggers twice ?JUNK MAIL? 4 ?JUNK MAIL? 4
>
> Hi Jocelyn,
>
> Thanks for the suggestion.
>
> 1. I tried using both FMs , but it did not trigger the event or start
> the WF in check FM. I tried extentions 'STARTING NEW TASK and IN
> BACKGROUND TASK'; none of them helped.
>
> 2. We are responsible to enhance the existing business workflows. I've
> to use whats already with minimal impact on the business.
>
> -----Original Message-----
> From: sap-wug-bounces at mit.edu [mailto:sap-wug-bounces at mit.edu] On Behalf
> Of Dart, Jocelyn
> Sent: Wednesday, November 16, 2005 9:00 AM
> To: SAP Workflow Users' Group
> Subject: RE: PO WF triggers twice ?JUNK MAIL? 4 ?JUNK MAIL? 4
>
> Manish,
>
> 1. ***Please*** use the released for customer functin
> SAP_WAPI_START_WORKFLOW not the internal function SWW_WI_START Better
> still use an event and SAP_WAPI_CREATE_EVENT rather than starting a
> workflow directly
>
> 2. Instead of re-using the standard PO/PR events which have their own
> criteria for start, why don't you extend the object type EINKBELEG by
> delegation to include your own custom event - by which you start *your*
> workflow.
>
> Your workflow can then raise the standard event if you still need it.
>
>
> Regards,
> Jocelyn Dart
> Senior Consultant
> SAP Australia Pty Ltd.
> Level 1/168 Walker St.
> North Sydney
> NSW, 2060
> Australia
> T   +61 412 390 267
> M   + 61 412 390 267
> E   jocelyn.dart at sap.com
> http://www.sap.com
>
> The information contained in or attached to this electronic transmission
> is confidential and may be legally privileged. It is intended only for
> the person or entity to which it is addressed. If you are not the
> intended recipient, you are hereby notified that any distribution,
> copying, review, retransmission, dissemination or other use of this
> electronic transmission or the information contained in it is strictly
> prohibited. If you have received this electronic transmission in error,
> please immediately contact the sender to arrange for the return of the
> original documents.
> Electronic transmission cannot be guaranteed to be secure and
> accordingly, the sender does not accept liability for any such data
> corruption, interception, unauthorized amendment, viruses, delays or the
> consequences thereof.
> Any views expressed in this electronic transmission are those of the
> individual sender, except where the message states otherwise and the
> sender is authorized to state them to be the views of SAP AG or any of
> its subsidiaries. SAP AG, its subsidiaries, and their directors,
> officers and employees make no representation nor accept any liability
> for the accuracy or completeness of the views or information contained
> herein. Please be aware that the furnishing of any pricing information/
> business proposal herein is indicative only, is subject to change and
> shall not be construed as an offer or as constituting a binding
> agreement on the part of SAP AG or any of its subsidiaries to enter into
> any relationship, unless otherwise expressly stated.
>
>
> -----Original Message-----
> From: sap-wug-bounces at mit.edu [mailto:sap-wug-bounces at mit.edu] On Behalf
> Of Khanna, Manish
> Sent: Wednesday, 16 November 2005 1:50 PM
> To: SAP Workflow Users' Group
> Subject: RE: PO WF triggers twice ?JUNK MAIL? 4
>
> 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
>
>
>
> _______________________________________________
> 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
>
>
>
> _______________________________________________
> 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