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 your valuable inputs Rob.
I am very sorry still I am not able to understand why do we need both custom event and custom attribute? As this custom event is only triggered by me in the user exit why do I need this attribute?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks Rick. Hope this is my last question here ....I have checked few threads in SCN about setting virtual attributes in BO and use it in workflow start condition? Is it possible to set virtual attribue in USER exit and check the value in work flow start condition? Or we need to have data base field? ...if this is not possible I would rather go with custom event as i don't want to extend standard table for this field?
Or with the combination of check function module at start condition and EXPORTing a value in the userexit then IMPORTing it in the function module...
I wanted to use the best available solution without disutrbing standard sap functionality
Hi,
You are still going to use an exit to trigger an event. what I was trying to tell you is that you don't want that. You want to use standard event (or through change docs, status management, etc.) then using an attribute and conditions you can control whether you want to start a workflow or not.
Kind regards, Rob Dielemans
Hi,
you keep on mentioning the user exit.
If you have an event or change doc when you save this data then you won't need to bother fiddling around with cumbersome user exits.
My advise was to extend the business object, add an attribute(or attributes) link the event to workflow, and then use conditions with your new attribute to control the workflow.
This is straightforward Workflow consultant stuff, so please try and do it this way to get accustomed to these methods so that you can keep on using these methods in the future.
Kind regards, Rob Dielemans
I think this is explained in the Workflow tutorial on help.sap.com.
1. Swo1, type in business object, click subtype.
2. Swo1, go to delegate and delegate the business object with your subtype
3. swo1, edit, open attributes, click create, source virtual, name description and reference
4. position cursor on your attribute and click program.
5. code your own attribute (check help or other business objects programming to get accustomed to macros used for setting the virtual attribute
6. generate (follow instructions, you might have to also change release status)
7. Swo1, test your business object and see if the attribute is created with correct values.
8. swe2, link sap standard business object event to your workflow (it is delegated)
9. swb_cond find your linked business object-->event and add a condition with your virtual attribute.
10. test.
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.