Difference Between Lock Mode E And X

What is the difference between lock mode E and X?

Lock mode controls whether several users can access data records at the same time. The lock mode can be assigned separately for each table in the lock object. When the lock is set, the corresponding lock entry is stored in the lock table of the system for each table

Lock modes:

S (Shared):

Several users (transactions) can access locked data at the same time in display mode. A request for another shared lock is accepted, even if it comes from another user. An exclusive lock set on an object that already has a shared lock will be rejected.

E (Exclusive).
 

An exclusive lock protects the locked object against all types of locks from other transactions. Only the same lock owner can reset the lock (accumulate). 

X (eXclusive non-cumulative):

Exclusive locks can be requested several times from the same transaction and are processed successively. In contrast, exclusive but not cumulative locks can be called only once from the same transaction. Each further lock request will be rejected.

O (Optimistic):

Optimistic locks initially behave like shared locks and can be converted into exclusive locks.
 
 

What is difference between Lock object and enqueue_e_table?
Where to use enqueue_e_table and where to use lock object? 

A lock object does not really "lock a table" though most of lock objects refer to a database table.

The principle is that when 2 programs lock at the same time with the same lock object, only the first will succeed.

If you have a program which does not use the lock, it may update the database table without any problem.

All programs which update a table have to use the same lock object. Note that users are always able to update this table via SM30 as they don't know the lock object to be used.

enqueue_xxxx is the name of the generated function module used to lock the xxxx lock object. E_TABLE lock is ONLY used by SM30 if I remember well, so that to prevent one table from being updated via SM30 by 2 persons at the same time. But it is not related at all with programs which would also update this table.

ABAP Tips

See Also

Get help for your ABAP problems
Do you have a ABAP Question?

ABAP Books
ABAP Certification, BAPI, Java, Web Programming, Smart Forms, Sapscripts Reference Books

More ABAP Tips

Main Index
SAP ERP Modules, Basis, ABAP and Other IMG Stuff

All the site contents are Copyright © www.erpgreat.com and the content authors. All rights reserved.
All product names are trademarks of their respective companies.  The site www.erpgreat.com is in no way affiliated with SAP AG. 
Every effort is made to ensure the content integrity.  Information used on this site is at your own risk. 
 The content on this site may not be reproduced or redistributed without the express written permission of 
www.erpgreat.com or the content authors.