Lock Object / SAP Lock Object / ABAP Lock Object
Email This BlogThis! Share to Twitter Share to Facebook
SAP Lock Objects are used to lock the table data which is accessed by the multiple
users. It is used to synchronize the user request.The objects which synchronizes
simultaneous access of several users to the same data records with lock mechanism.
•Lock objects name starts with EY or EZ.
•Every lock object when activated creates two function modules:
Enqueue_<lock object name>: For setting locks.
Dequeue_<lock object name>: For releasing locks.
•All tables included must be linked with FK. FK fields must be key fields of FK table.
•The lock argument of a table in the lock object consists of the key fields of the table.
•Use TCODE SU01 for creating new user name.
Lock Modes
•Exclusive & cumulative : The locked data can only be displayed or edited by a
single user. It can be requested several times from the same transaction and
are processed successively.
•Shared : More than one user can access locked data at same time in display mode.
•Exclusive not cumulative : The locked data can only be displayed or edited by a single
user but it can be called only once from the same transaction.
Lock Object Function Module Parameters
•Field name
•X_<field name>: If <field> = initial value & X_<field> = initial value -> generic lock.If
<field> = initial value & X_<field> = X ->lock is set with exactly initial value of
<field>.
•Mode_<tab>: E,S,X for each table.
•_Scope : 2 for enqueue & 3 for dequeue.
•_Wait : If _wait = initial value & if there is competing lock,a lock attempt
fails. If _wait = X & if there is competing lock,lock attempt fails for first time.
Lock attempt is repeated after waiting for certain time. FOREIGN_LOCK
exception is triggered only if certain time is elapsed.
•SYSTEM_FAILURE exception is triggered when problem occurred while setting lock.