cancel
Showing results for 
Search instead for 
Did you mean: 

BAPI inside WF event trigger problem

matias_z
Participant
0 Kudos

Hi Guys,

Here's my problem:

I'm triggering a WF from the Business objects BUS2032, event CHANGED (for sales orders). But the first step in the workflow is to block the order for delivery, so I'm using the BAPI BAPI_SALESORDER_CHANGE to modify the field delivery block of that sales order.

The problem is that when the BAPI is executed, the event CHANGED from the BO BUS2032 is triggered, so the WF is triggered again, and so on...it's like a loop.

So my question is, is there a way to modify the sales order inside the WF without triggering any event inside the WF?

Thanks!

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

I think you can create a virtual attribute that will be of type BOOLE-BOOLE and will get set when this FM

SAP_WAPI_WORKITEMS_TO_OBJECT

returns an entry in the Worklist parameter. Please provide the Business object as BUS2032 and the sales order number in the FM import parameter.

Use this attribute in order to create Start condition from SWB_COND Tcode and if this attribute is blank then it should trigger workflow.

You can also make use of Check Function module in SWE2 entry for your Workflow.

Thanks

Arghadip

Former Member
0 Kudos

An attribute delivery block can be created and start condition can be set for the event as delivery block not equal to blank.

matias_z
Participant
0 Kudos

There's another problem related to it...is that al the end of the WF, if it is accepted there's a task that removes the delivery block of the sales order....so the checking if the delivery block is initial for the start condition is not going to work...

Former Member
0 Kudos

The you have no other choice than going for Arghadip's solution.

Cheers,

Patrick

matias_z
Participant
0 Kudos

Thank's to all.

I'll use the solution with the SAP_WAPI_WORKITEMS_TO_OBJECT

Answers (1)

Answers (1)

chaiphon
Contributor
0 Kudos

Hi MatiasAZ,

Change standard code to not trigger the event is not recommended.

Alternatively,You can put a check in your workflow to complete itself if there is another workflow is running for the same sales order.

Or you can also put filter function module on the event linkage via transaction SWETYPV not to trigger the event if there is a workflow running for that sales order.

Transaction SWI6 can tell you that any workflow with specific object is running.

Chaiphon