Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Starting new task inside an Update Task

Former Member
0 Kudos

Hi guys,

I need an expert opinion for a problem I'm facing at the moment.

The requirement is this: I need to trigger a function module during the update task of a material document.

This function module however should not slow down the posting of the document, so it must not be in the same LUW, but in a separate task.

My question is: does it work to call a function module with STARTING NEW TASK inside an UPDATE TASK (for example a user exit) and if it does work, what's your opinion on it? Is if safe? Does it come with problems? According to the SAP documentation, STARTING NEW TASK does not trigger a COMMIT when it's called inside an update task.

The alternative would be to trigger a work flow, but that's much more work.

Any input is welcome.

Thanks.

3 REPLIES 3

Private_Member_7726
Active Contributor
0 Kudos

Hi,

I may be completely mistaken, but I interpret the following quote from ABAP Docu to mean: STARTING NEW TASK does implicit COMMIT:


Asynchronous RFC triggers a database commit in the calling program. An sRFC during the update is an exception to this.

Meaning - there is no commit if you omitt STARTING_NEW_TASK - use sysnchronous RFC...

Where did you read that it does not trigger COMMIT?

cheers

Janis

0 Kudos

Hello Janis,

Just to reiterate this aRFC call triggers an implicit database commit. So the OP is partially correct

we have 2 things which we need to consider -

  • Asynchronous RFC triggers a database commit in the calling program.
  • Any database commits or database rollbacks that occur within the update task cancel the update.

Simply put, as per SAP documentation, you cannot use aRFC within an update task.

BR,

Suhas

former_member555112
Active Contributor
0 Kudos

Hi,

You don't  need a workflow.

What you can do is just create a simple task and bind it to a class.

For the task you have option of either binding to a business object or to a class.

So use the option for a class.

The task should be triggered at the event of material document creation event.

In the method of the class you can call the function module you need.

Regards,

Ankur Parab