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: 

Regarding commit and set update task

phoenixming0912
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi all,

In a given solution, I need to commit an API and then read db to get committed data right after the commit.

It's something like: CALL API FUNCTION (will update DB) -> COMMIT -> SELECT DB TABLE

I think I will code like:

CALL FUNCTION 'ABC'.

COMMIT WORK AND WAIT.

My question is if it is required to use "set update task local" after the function calling.

Regards,
Eric

1 ACCEPTED SOLUTION

Sandra_Rossi
Active Contributor
0 Kudos

If you just do CALL FUNCTION 'ABC', it's called immediately.

I guess you mean CALL FUNCTION 'ABC' IN UPDATE TASK. In that case, using AND WAIT after COMMIT WORK guarantees that it waits for the end of the update task.

SET UPDATE TASK LOCAL is just in case you want to execute faster. It MUST be called before the first CALL FUNCTION ... IN UPDATE TASK otherwise it will fail.

After COMMIT WORK AND WAIT, it's guaranteed that the data is committed (unless concerning V2/V3 updates which are done later).

More information: SET UPDATE TASK LOCAL

--------------------------------

NB: If you just do CALL FUNCTION 'ABC', without IN UPDATE TASK, it's called immediately, meaning NO update task.

If you don't use an update task, SET UPDATE TASK LOCAL doesn't apply.

Without an update task, COMMIT WORK works as usual, it commits the database.

AND WAIT is useless without an update task.

More information: COMMIT WORK

3 REPLIES 3

Sandra_Rossi
Active Contributor
0 Kudos

If you just do CALL FUNCTION 'ABC', it's called immediately.

I guess you mean CALL FUNCTION 'ABC' IN UPDATE TASK. In that case, using AND WAIT after COMMIT WORK guarantees that it waits for the end of the update task.

SET UPDATE TASK LOCAL is just in case you want to execute faster. It MUST be called before the first CALL FUNCTION ... IN UPDATE TASK otherwise it will fail.

After COMMIT WORK AND WAIT, it's guaranteed that the data is committed (unless concerning V2/V3 updates which are done later).

More information: SET UPDATE TASK LOCAL

--------------------------------

NB: If you just do CALL FUNCTION 'ABC', without IN UPDATE TASK, it's called immediately, meaning NO update task.

If you don't use an update task, SET UPDATE TASK LOCAL doesn't apply.

Without an update task, COMMIT WORK works as usual, it commits the database.

AND WAIT is useless without an update task.

More information: COMMIT WORK

phoenixming0912
Product and Topic Expert
Product and Topic Expert
0 Kudos

Is "IN UPDATE TASK" a must? What if I CALL FUNCTION 'ABC' without "IN UPDATE TASK" but also COMMIT WORK AND WAIT"?

BTW, function ABC is a regular function module other than an update module.

0 Kudos

As I said: "If you just do CALL FUNCTION 'ABC', it's called immediately."

i.e. no update task.

If you don't use an update task, SET UPDATE TASK LOCAL doesn't apply.

Without an update task, COMMIT WORK works as usual, it commits the database.

AND WAIT is useless without an update task.