Application Development and Automation 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: 
Read only

commit work and wait

Former Member
0 Likes
1,101

Hi,

if we use commit work and wait, it updates V1 type update records.

What does it mean?

7 REPLIES 7
Read only

JozsefSzikszai
Active Contributor
0 Likes
870

hi,

it means, that the program waits until the updates are done in the DB. So if you do a SELECT after this for the newly created records, it is sure that there will be result.

ec

Read only

0 Likes
870

If you execute work and wait, and you have made change in the data base, this changes will be carried out in the data base, and you could not make a rollback to unddo this changes. So it is very dangerous to carried out, and you have to avoid it when posible.

Read only

0 Likes
870

Hi,

that can be done only commit work.

no need of use commit work and wait, to confirm the changes in the database.

could anybody tell the difference.

I appreciate ur help.

Read only

0 Likes
870

hi Paluri,

I tried to explain, what don't you understand? (Never mind Francisco's explanation, it is complete ****...).

Let's try again:

COMMIT WORK - asynchron update, program continues running, the update is done in a separate work process

COMMIT WORK AND WAIT - synchron update, update runs in a separat work process, but the program waits until it is finished

rgds

ec

Read only

0 Likes
870

Hi,

Suppose I used call transaction to update one sales order record,

after call transaction if I used commit work and wait.

execution resumes untill the sales order get updated.

Is it?

Read only

0 Likes
870

you don't have to use COMMIT WORK after CALL TRANSACTION. You have to do:

CALL TRANSACTION .... UPDATE 'A'

this will be simple COMMIT WORK (A stands for asynchron)

CALL TRANSACTION .... UPDATE 'S'

this will be COMMIT WORK AND WAIT (S stands for synchron)

If you update only one record in your program it does not matter (I guess) how you do. Problems can arise when you update several items of one document in one run (Because the lock takes place on document level, while you do the update item by item - in this case you have to do in synchron mode).

Read only

Maciej_DomagaBa
Contributor
0 Likes
870

The difference between "commit work and wait" and just "commit work" is important when you perform database updates using function modules called "in update task".

So if you have a function module and in its attributes you have marked an option "Update module" and "Start immediately", and you call the module with "call function ... in update task", you tell the system that this function module should be executed not at the moment of statement "call function" but at the next commit work. In this case the statement "call function" only creates "V1 record" which means that the system stores parameters passed in this "call function" - to be used later when the module will be actually executed.

The execution of that module is triggered by "commit work" statement - or by "commit work and wait" and takes place in a separate process. If you use "commit work" in your code then your code continues execution without waiting for the function module to finish. But if you use "commit work and wait" your code waits for the module to finish executing and continues after the module has finished.

So both "commit work and wait" and "commit work" update "V1 records" but in case of using "commit work" the update operation may be not finished yet if you check for this from within a code right after the "commit work" statement.

For more details take a look at <a href="http://help.sap.com/saphelp_46c/helpdata/en/41/7af4b6a79e11d1950f0000e82de14a/frameset.htm">Programming Database Updates</a> -> Update Techniques

regards