on ‎2013 Sep 09 2:04 PM
Hi Experts,
I wanted to trigger a custom workflow during sales order creation/change. As I wanted to start workflow only based on some complex conditions I have decided to trigger it from user exit MV45AFZZ/USEREXIT_SAVE_DOCUMENT. Buidling this logic as workflow starting condition or @ event linkage is not possible.
I can think of two options here to start workflow from user exit.
Option1: Start the workflow directly with the FM SAP_WAPI_START_WORKFLOW'. I doubt workflow triggerd in this way is not linked to the transaction and thus I shouldnt be able to see this from VA02/03?
Option2: Link my custom workflow to an event and triggering the event using FM SAP_WAPI_CREATE_EVENT. Events CREATED/CHANGED for business object BUS2032 are triggered whenever sales order is changed/created. I am confused here about what event I need to link to my workflow and trigger? Do I need to create a subtype for 2032 and link my custom workflow and trigger CREATED & CHANGED event? As I am not changing anything for the business object my question is why should I create a subtype?
Much appriciated for any calrification on this,
Thanks,
Rams V.
Request clarification before answering.
Thanks a lot for all your inputs. I just wanted to check if my understading is correct? I have two options here...
Option1 - I need to create a custom event for the deligated business object. Then I need to trigger this event from my user exit based on the triggering logic. And also define my workflow specifying the custom starting event.
Option2 - I need to add an attribute for the deligated business object. Define the workflow for the standard CHANGED/CREATED business objects with starting condition validating the custom attribute. Set the custom attribute in my user exit (I need to find out how to set this attribute).
Please clarify. Thanks.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Your best option is to :
first create a subtype and delegate the business object.
Create an event on your subtype, similar to changed/create
create a virtual attribute on your subtype, in the coding place your logic needed to validate the triggering.
Link the event to the workflow.
Use conditions SWB_COND for this linkage and include the attribute with logic for triggering the workflow or not ( attribute = 'X' or similar)
That way you have full control over your workflow and events. In the case of changes you can easily switch it on, or of. And maintenance wise it is easier to understand an extra attribute than it is to understand loads of abap in exits.
hope this clears things up.
Kind regards, Rob Dielemans
| User | Count |
|---|---|
| 15 | |
| 9 | |
| 6 | |
| 5 | |
| 4 | |
| 4 | |
| 3 | |
| 2 | |
| 2 | |
| 2 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.