Application Development and Automation 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: 
Read only

Regarding Lock Object

Former Member
0 Likes
1,596

Hi Experts,

Can you please guide me how i can find out the lock object name. If i know the table name. is there any table which stores the table name and lock object name for that table.

Or any function module to which i can pass table name in return i can get lock object name.

i have to do all this by coding.

Its very urgect.

Thanks in advance.

AZAD:)

7 REPLIES 7
Read only

Former Member
0 Likes
1,318

Hi

Lock Objects Tables is: <b>DD25L</b>

Lock objects are use in SAP to avoid the inconsistancy at the time of data is being insert/change into database.

SAP Provide three type of Lock objects.

- Read Lock(Shared Locked)

protects read access to an object. The read lock allows other transactions read access but not write access to

the locked area of the table

- Write Lock(exclusive lock)

protects write access to an object. The write lock allows other transactions neither read nor write access to

the locked area of the table.

- Enhanced write lock (exclusive lock without cumulating)

works like a write lock except that the enhanced write lock also protects from further accesses from the

same transaction.

You can create a lock on a object of SAP thorugh transaction SE11 and enter any meaningful name start with EZ Example EZTEST_LOCK.

Use: you can see in almost all transaction when you are open an object in Change mode SAP could not allow to any other user to open the same object in change mode.

Example: in HR when we are enter a personal number in master data maintainance screen SAP can't allow to any other user to use same personal number for changes.

Technicaly:

When you create a lock object System automatically creat two function module.

1. ENQUEUE_<Lockobject name>. to insert the object in a queue.

2. DEQUEUE_<Lockobject name>. To remove the object is being queued through above FM.

You have to use these function module in your program.

check this link for example.

http://help.sap.com/saphelp_nw04s/helpdata/en/cf/21eea5446011d189700000e8322d00/content.htm

tables:vbak.

call function 'ENQUEUE_EZLOCK3'

exporting

mode_vbak = 'E'

mandt = sy-mandt

vbeln = vbak-vbeln

  • X_VBELN = ' '

  • _SCOPE = '2'

  • _WAIT = ' '

  • _COLLECT = ' '

  • EXCEPTIONS

  • FOREIGN_LOCK = 1

  • SYSTEM_FAILURE = 2

  • OTHERS = 3

.

if sy-subrc <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

endif.

Reward points if useful

Regards

Anji

Message was edited by:

Anji Reddy Vangala

Read only

0 Likes
1,318

Hi Anji,

Thanks for your reply. But i know this. we can use in this way.

But the requirment is in dynamic programming i m passing table name on selection screen. so i have to find out lock object name by programming for that particular table.

Thanks!

Read only

Former Member
0 Likes
1,318

Hi,

if u create a lock object system will generate enqueue_<lock object> and dequeue_<lock object>.

goto abapdocu tcode.

select ABAP Database Access ->SAP Transaction Concept ->Setting and Releasing Locks .

see the that program to lock and unlock.

goto se11 and see the lock object "EDEMOFLHT"(this is related to the above program).

rgds,

bharat.

Read only

0 Likes
1,318

Hi bharat..

this much i know. My requirment is different buddy. just read carefully after that if u can do ..then do the need full.

Thanks

Read only

0 Likes
1,318

Hi Azad,

am also having this same challenge... just wanted to know if you found the answer. If yes can you please share Thanks

regards

Basha

Read only

0 Likes
1,318

You can query table DD25L with table name and it returns the Lock object name

concatenate lock object name with 'ENQUEUE_' in the beginning and then use call function

but how do we get the exporting parameters is the question

e.g.

table name : ztest

lock object name : eztest_lock.

query table DD25L with roottab = 'ztest'

this will return 'EZTEST_LOCK' in field viewname

now concatenate 'ENQUEUE_' and "EXTEST_LOCK' into v_lock

call function v_lock.

but how to do this with exporting parameters

am working on this.. ill let you know if i get an answer

regards

Basha

Read only

0 Likes
1,318

I think you can use either of this 2 function modules

1. ENQUEUE_E_TABLE - Pass the table name and the fields based on which table should be locked in TABNAME and VARKEY parameters respectively. If you want to lock the table based on more than one key field, concatenate the key and pass it to VARKEY field.

e.g. to lock VBAP for client 100 order no 0000000001 and item 000010 pass

VBAP to TABNAME and

1000000000001000010 to VARKEY

also MODE_RSTABLE should be given E or S or X

2. VIEW_ENQUEUE - this will also lock the table which you pass in VIEW_NAME parameter. i didnot get much success on this one.

Reagrds

Basha