SAP Locks

SAP Locks is used to program different types of lock which is set across more than one database LUWs. The database locks is of much shorter period than the SAP lock. This database lock is set in duration of transaction and remains there till DEQUEUE_'lockobjectname' function module is get called.

Q. Define Lock mode?
A. It defines how to synchronize table record access by several users. The following modes exist:

1. Exclusive Lock - The locked data can be read or processed by one lock owner only. The same owner can only reset the lock. A request for all other locks are rejected.

2. Shared Lock - Several users can read the same data at the same time in display mode only, but as soon as a user edits the data, a second user can no longer access this data. Requests for further shared locks are accepted from different users, but exclusive locks are rejected.

3. Exclusive but not cumulative lock - Exclusive locks can be requested by the same transaction several times and are processed successively, but an exclusive but not cumulative locks can only be called once from the same transaction. All further lock requests are rejected.

4. Optimistic Lock - This is a new lock mode. This lock is require if the data is accessed by several user simultaneously and the lock needs to be set for consistent data changes, in case if user displays the data in change mode. Thus, initially it bahaves like a shared locks but if user goes for data change then this needs to get converted into exclusive locks.

Q. What function module get generated when you activate a lock?
A. When you activate the lock, the two function modules ENQUEUE_'lockobjectname' and DEQUEUE_'lockobjectname' get generated. These two locks are used to set and release the locks respectively.







                                                      Copyright © 2011 All rights reserved.