Different types of Locks in SAP

Why object locks?
The locks are used in sap to prevent concomitant change of an object by two developer.

The enque work process manages the locking system. The lock entries for data to be processed in lock table which is maintained in  main memory.

Various Lock Modes in SAP

Shared Lock (S):
Several users can access the locked data at the same time in display mode.
Requests for further shared locks are accepted, even if they are from other users.
Exclusive locks are rejected.

Exclusive lock (E):
The locked data can be displayed or edited by one user only.
Requests for either another exclusive lock or a shared lock are rejected.

Optimistic Lock (O):

An optimistic lock can be set if the data is displayed in change mode and the lock behaves like a shared lock if there are access collisions. But if the data is changed, the optimistic lock converts to an exclusive lock. 0ptimistic locks on the object then become invalidated. It can therefore be possible that the conversion fails, if beforehand another optimistic
lock was converted. In such cases the use of optimistic locks is only beneficial, if the probability that the data will NOT be changed is high.

Exclusive but not cumulative lock (X):

Exclusive but not cumulative locks can only be requested by the same transaction once only.
All further lock requests are rejected.

Comments are closed.