2022 Sep 21 10:44 AM
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
2022 Sep 21 12:43 PM
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
2022 Sep 21 12:43 PM
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
2022 Sep 22 2:51 AM
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.
2022 Sep 22 7:51 AM
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.