cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Triggering workflow

Former Member
0 Likes
8,389

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.   

View Entire Topic
Former Member
0 Likes

Hello,

Option 2 is the way to go, always use an event to start workflow when you can.

"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?"

You only need a subtype if you're changing or adding something to the BO.

It seems to me you can just use the existing CHANGED or CREATED events, but there must be c omplication otherwise you wouldn't be asking, I guess?

regards

Rick Bakker / hanabi technology

Former Member
0 Likes

CHANGED & CREATED events for BUS2032 will be triggered anyhow when there is sales order change or create without me triggering them from user exit explicitly?

anjan_paul
Active Contributor
0 Likes

Hi,

  If I am not wrong, you only want to start workflow from User exit only based on some condition. Then if you trigger CHANGED & CREATED events for BUS2032, then you feel other workflow may trigger.

  If this is  the case, then there have 2 option. 1st option is you have to call the workflow directly usin FM SAP_WAPI_START_WORKFLOW. You don't have fear that it will not visible from VA02/03 servces for object. If your workflow having any container element of BUS2032 and in workflow basic data General Task has been maintain, then from VA02/03 your workflow will be visible in Services  for object.

2nd option is create a subtype of BUS2032 and create one custom event in subtype, and trigger that custom event to start your workflow, then no other workflow will trigger. That case also if you want to see the workflow overview in VA02/03, then your workflow must have container element of BUS2032 and in workflow basic data General Task has been maintain

Former Member
0 Likes

Hello,

Okay, now I understand.

I would not add code to create those or other events. I would extend the BO and use an attribute in the Start Condition (as suggested by Rob) or - if that didn't work - I would build it into the workflow itself.

regards

Rick Bakker