Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

How to detect whether a database table is locked or not

Anindya
Explorer
0 Kudos
779

Hi All,

How can i detect whether a specific database table has been locked or not.

If the table is not locked i will have to update the table from my program.

Are there any standard Function Modules avalable for this ????

Thanks in advance....

regards,

Anindya

4 REPLIES 4

Former Member
0 Kudos
278

When you try to ENQUEUE any table for Locking in return you will get to know whether the lock is successful or not.

I suppose you can just check for sy-subrc = 0 => Successfully Locked. Insert Data

sy-subrc <> 0 => Table is already locked.

Former Member
0 Kudos
278

Hi Anindya,

Just got to T.code SM12(Lock Entries), which gives the table name and user who has locked.

for checking purpose,

create lock object to any ztable which create two FM enqueue and Dequeue just keep a break point in between these FM and check the transaction SM12.

Regards

Kumar M

Former Member
0 Kudos
278

Hi,

Use FM ENQUEUE_EBU_PARTNR

OR

go to SM12 transaction

You can use function ENQUEUE_READ.also you can use the function module GET_LOCKLIST_ADA

Former Member
0 Kudos
278

go to trasection sm12

use FM ENQUE_READ

IF SY-SUBRC = 0 then it is successfully locked.

to learn lock mechenism go to this link

http://www.slideshare.net/guest28d364/abap-table-lock-object/