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

Tables without locks

Former Member
0 Likes
850

Hi

I understand that somehow I would have to create locks to avoid table collision when updating tables by several users. What happens if I don't do that, meaning while one user is writing and updating a table and another is do in the same to the same table? Will the program give a runtime error? Are all the users running the program will run into the runtime error?

Thanks,

RT

1 ACCEPTED SOLUTION
Read only

RichHeilman
Developer Advocate
Developer Advocate
0 Likes
769

Rob, there will be no ABAP runtime error if you don't use the locks, but you will have data inconsistancies. For example, say user 1 bring up a record of the ztable, and needs to change the description, say field number 2. User goes and gets a cup of coffee without saving, User 2 enters the transaction and wants to change the description of the same record that user 1 has open, user 2 saves and exits. User 1 comes back and saves the changes, the description field has now been updated overwriting the value that user 2 had previously changed. You can see the importance of locking, right?

Regards,

Rich Heilman

3 REPLIES 3
Read only

Former Member
0 Likes
769

Hi Rob,

This is done to aviod any inconsistency while accessing the database.

Well locking the table ensures the basic ACID properties of the DB.

A--> Atomicity

C--> Consistency

I--> Isolation

D--> Durabilty

Trying to update the database table at the same time might result into inconsistency.

DB_SQL_ERROR runtime might be issued.

Never seen it personally though!

Also refer to

http://help.sap.com/saphelp_nw04s/helpdata/en/41/7af4c5a79e11d1950f0000e82de14a/content.htm

Hope that helps!

Regards,

Tanveer.

<b>Please mark helpful answers</b>

Read only

ferry_lianto
Active Contributor
0 Likes
769

Hi Rob,

The SAP system is equipped with a special lock mechanism that synchronizes access to data on the database. The purpose of the lock mechanism is to prevent two transactions from changing the same data on the database simultaneously.

Also please check this link.

http://help.sap.com/saphelp_nw04s/helpdata/en/41/7af4c5a79e11d1950f0000e82de14a/content.htm

Regards,

Ferry Lianto

Read only

RichHeilman
Developer Advocate
Developer Advocate
0 Likes
770

Rob, there will be no ABAP runtime error if you don't use the locks, but you will have data inconsistancies. For example, say user 1 bring up a record of the ztable, and needs to change the description, say field number 2. User goes and gets a cup of coffee without saving, User 2 enters the transaction and wants to change the description of the same record that user 1 has open, user 2 saves and exits. User 1 comes back and saves the changes, the description field has now been updated overwriting the value that user 2 had previously changed. You can see the importance of locking, right?

Regards,

Rich Heilman