0% found this document useful (0 votes)
22 views11 pages

Lock Object

Uploaded by

srsatapathy087
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
22 views11 pages

Lock Object

Uploaded by

srsatapathy087
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 11

Lock Object

It’s Used to Avoid the Concurrent access of multiple users on


the Same Database.
Row-Level Locking

 Go to TCODE-SE11, Provide the lock object name and Click on


Create Button.

 Provide the table name and Select the Lock mode as Write Lock
and Click on the Lock Parameter Tab

 All the primary key fields of the given table are added under the
Lock parameter section.

 Activate the Lock Object.

 When the lock object is activated it creates two function


modules ‘Enqueue & Dequeue’.

 Navigate along the below shown path to get the generated


function modules
Let’s use the generated function module in a program.

Go to TCODE- SE38, provide a report program name and click on


create button.
Run the first session and we have the output. Execute the same report
in second session,

now we have the error message given below as the same record is
locked in first session.
Now again run the same report in two different sessions and provide
different inputs and execute it.

Now no error message is there.


Now the record is locked. Now Unlock the Record By clicking on the
Application toolbar button that is created in the program PF Status.
Now run the Report in the Second session.
Table-Level Locking

 Go to TCODE-SE11, Provide the lock object name and Click on


Create Button.

 Provide the table name and Select the Lock mode as Write Lock
and Click on the Lock Parameter Tab

 All the primary key fields of the given table are added under the
Lock parameter section.

 Activate the Lock Object.

Create a report program and call the standard FM


‘ENQUEUE_E_TABLE’ and pass the table name to request for
a lock and call the FM ‘DEQUEUE_E_TABLE’ to release the
lock.
Here another report which want to update the table after lock is
generated
Run the first report and an exclusive lock is granted for
ZCUST_ID_1 table and you can see the lock entry in SM12
transaction. This report locks table ZCUST_ID_1 for around 8 mins
and then release the lock

The table ZCUST_ID_1 is already in lock mode for 8 mins by first


program and when this program runs in the same 8 mins of the
interval, the lock is not granted (sy-subrc = 1) and just the program
quits. In this way the data consistencies can be maintained by the
table level lock concept.

You might also like