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

Reg:Commit and Roll back

kesavadas_thekkillath
Active Contributor
0 Likes
979

Hi all,

Im bit confused with transactional concepts commit work/rollback work.

In below program after the insert statement the data is written into db, and after rollback the data is taken back from db

wa-Z_DEPT = 'IWW'.

wa-Z_DEPTNO = '1TT'.

ZAA_EMP = wa.

insert ZAA_EMP.

ROLLBACK WORK.

in the below program the data is not taken back from db after roll back when i give a commit after insert.

insert ZAA_EMP.

COMMIT WORK.

ROLLBACK WORK.

Is it mandatory to commit after a insert statement.

Is it possible to rollback after a commit.

Is there no implicit commit happening after the insert statement.

Anybody there please clear my doubts.

Regards,

Keshu

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
948

hI,

After commiting the work u cannot roll back the work unless the commit is not successful.

8 REPLIES 8
Read only

Former Member
0 Likes
949

hI,

After commiting the work u cannot roll back the work unless the commit is not successful.

Read only

SuhaSaha
Product and Topic Expert
Product and Topic Expert
0 Likes
948

Hello,

FYI, once you do a COMMIT WORK the database LUW is complete & if yes the COMMIT is successful you can no longer ROLLBACK.

I think you must read [Database LUW concept |http://help.sap.com/saphelp_nw70/helpdata/EN/41/7af4bca79e11d1950f0000e82de14a/content.htm] in SAP.

BR,

Suhas

Read only

0 Likes
948

Hi Suhas,

So after a insert statement is it mandatory to do a commit work ?

Read only

SuhaSaha
Product and Topic Expert
Product and Topic Expert
0 Likes
948

>

> So after a insert statement is it mandatory to do a commit work ?

Hello KSD,

It is not "mandatory" to do a COMMIT after any DB operation.

There are some cases of implicit commits which you can get from the SAP help documentation . And you can always do an explicit COMMIT

BR,

Suhas

PS: Please go through the SAP documentation link, very well documented

Read only

Former Member
0 Likes
948

As far as i kknow, its notmandatory to use COMMIT after INSERT.

We use COMMIT stmt to update our record in that very micro-second by crossing all other LUW queue.

Even though u dont use commit, your records will be inserted as per the LUW queue but few micro seconds later.

thanks,

Padma

Read only

0 Likes
948

As far as i kknow, its notmandatory to use COMMIT after INSERT.

what if it triggers a roll back of some other statements after an insert withou commit.

@Suhas:Let me read the doc :).

Thanks,

Keshu

Read only

Former Member
0 Likes
948

Hello

You may use only COMMIT or only ROLLBACK.

COMMIT is not work after ROLLBACK and vice versa.

Read only

Former Member
0 Likes
948

Hi,

Can you please try this



insert ZAA_EMP. 
COMMIT WORK AND WAIT. "Note
ROLLBACK WORK.

Probably, the work is <edited>not<edited> rolled back because the COMMIT statement is taking a long time to execute.

The F1 says

If you do not specify the addition AND WAIT, the program does not wait until the update work process has executed it (asynchronous updating), but instead is resumed immediately after COMMIT WORK.

Edited by: Nitwick on Dec 4, 2009 3:59 PM