cancel
Showing results for 
Search instead for 
Did you mean: 

Workflow design questions: FM vs WF to call FM

Former Member
0 Kudos

Hereu2019s a couple of workflow design questions.

1. We have Workitem 123 that allow user to navigate to a custom transaction TX1. User can make changes in TX1. At save or at user command of TX1, the program will call a FM (FM1) to delete WI 123 and create a new WI to send to a different agent.

Since Workitem 123 is still open and lock, the FM1 cannot delete it immediately, it has to use a DO loop to check if the Workitem 123 is dequeued before performing the WI delete.

Alternative: instead of calling the FM1, the program can raise an event which calls a new workflow, which has 1 step/task/new method which call the FM1. Even with this alternative, the Workitem 123 can still be locked when the new workflowu2019s task/method calls the FM1.

I do not like the alternative, which calls the same FM1 indirectly via a new workflow/step/task/method.

2. When an application object changes, the user exit will call a FMx which is related to workflow. The ABAP developer do not want to call the FMx directly, she wants to raise an event which call a workflow .. step .. task .. method .. FMx indirectly. This way any commit that happens in the FMx will not affect the application objectu2019s COMMIT.

My recommendation is to call the FMx using u2018in Update tasku2019 so that the FMx is only called after the COMMIT of the application object.

Any recommendation?

Amy

Accepted Solutions (0)

Answers (5)

Answers (5)

Former Member
0 Kudos

Mike,

Thanks, you answered my questions.

Have a safe day!

Amy

Former Member
0 Kudos

Mike,

Yes, in my first design, the TX can 1. raise a terminating event for the existing workitem/workflow and then 2. raise another event to call another workflow. Both 1 and 2 will be in FM1.

Then the design question is: Should the FM1 be called from TX directly or should the TX raise an event to call a new workflow which has 1 step/task, which calls a method in the Business object, and the method calls the FM1?

In my second design question, when an application object changes, the user exit will call a FMx which is related to workflow. The ABAP developer do not want to call the FMx directly, she wants to raise an event which call a workflow, which has 1 step/task, which calls a method, which calls the FMx indirectly. This way any commit that happens in the FMx will not affect the application objectu2019s COMMIT.

My recommendation is either call the FMx using u2018in Update tasku2019 so that the FMx is only called after the COMMIT of the application object or raise an event to call a receiver FM (FMx).

Thanks.

Amy

pokrakam
Active Contributor
0 Kudos

Hello Amy,

It sounds to me are like a very long way round. In fact, you don't even need two events. Just call SAP_WAPI_CREATE_EVENT in your transaction's update.

If you are using a terminating event, this is processed in an RFC so it would be unaffected by any COMMITs. The only part that is relevant here is that the event is raised at the point when the original transaction is committed. This is best practice and not advisable to change. The same goes for starting a second workflow, so this is just unnecessary work.

Cheers,

Mike

pokrakam
Active Contributor
0 Kudos

Hi Amy,

Why not use terminating events? This is exactly the type of thing they're designed for. If you also set your task to execute asynchronously then there won't be any locks.

Cheers,

Mike

Former Member
0 Kudos

Mike,

Thanks for your suggestion.

What about my 2 design questions?

Should we 'call the FM' or 'raise an event to call a workflow which has 1 task to call the FM' ?

Amy

pokrakam
Active Contributor
0 Kudos

Hi Amy,

I think you misunderstood. Terminating events are designed to do what you are trying to do with FM1. No need for such workarounds.

e.g. The task has a terminating event BUS9999.RESTARTED, and the workflow has a triggering event BUS9999.RESTARTED.

Your TX just needs to raise the event -> the task will complete and a new workflow will start. Or you could have the event as a terminating event for your workflow so the entire workflow gets a completed status.

Cheers,

Mike

Edited by: Mike Pokraka on Sep 15, 2008 10:46 PM - have a look here for more info:

[http://help.sap.com/saphelp_nw70/helpdata/EN/c5/e4b590453d11d189430000e829fbbd/frameset.htm]

Former Member
0 Kudos

What about instead of deleting the work item, you complete it?

Former Member
0 Kudos

Hi,

first develop dummy method.

Then in activity step use RULE in background you can call Functn Module.

Then give your desired code and fill actor-tab accordingly.

Hope this will help you!

Regards,

Purvesh Patel.