2022 Jul 28 5:27 PM
Consider the following statement:
DATA(ls_mara) = VALUE mara( matnr = 'TEST_10000' ).
INSERT mara FROM ls_mara.
COMMIT WORK AND WAIT.
SELECT SINGLE FROM mara
FIELDS *
WHERE matnr EQ 'TEST_10000'
INTO @DATA(ls_result).
[...]
We want to make sure - after the INSERT - that the record had been written to the db table and only after that want to proceed with the following statements. LS_RESULT shouldn't be empty after the SELECT.
- Would a COMMIT WORK be even necessary or would the INSERT be already enough?
- Is the AND WAIT addition of any use in this scenario? (no usage of UPDATE IN TASK, just plain procedual processing)
2022 Jul 28 6:01 PM
If you do the INSERT and SELECT in the same DB LUW, you don't need to commit immediately. It must be done at the moment when all insert/updates are in a consistent state.
No need of AND WAIT. Even COMMIT WORK is excessive, because it does many more things than just a DB Commit (transactional/queue RFC, update task, etc.)
Just look at the ABAP documentation to understand what means COMMIT WORK.
2022 Jul 29 8:02 AM
2022 Jul 29 8:30 AM