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

lock object

Former Member
0 Likes
896

hi gurus......

locking a table means , is it locking all the fields or just the key fields?

1 ACCEPTED SOLUTION
Read only

RichHeilman
Developer Advocate
Developer Advocate
0 Likes
867

It is locking the record based on the key fields. Not locking the actual fields of the row, but the entire row based on its keys.

Regards,

Rich Heilman

8 REPLIES 8
Read only

RichHeilman
Developer Advocate
Developer Advocate
0 Likes
868

It is locking the record based on the key fields. Not locking the actual fields of the row, but the entire row based on its keys.

Regards,

Rich Heilman

Read only

0 Likes
867

hi Rich Healman....

thanks for the reply , could u plz explain me little bit....

Read only

Former Member
0 Likes
867

It is locking the record based on the key fields in that table.

when evevr we lock the object system automatically creates function modules.

with names ENQUEUE_LOCKOBJECTNAME.

DEQUEUE_LOCKOBJECTNAME.

Read only

vinod_vemuru2
Active Contributor
0 Likes
867

Hi Diana,

It depends on how u created the lock object. When u create a lock object for the table u have to give the parameters based on which u want to lock. So when u call Enqueue FM u can see these parameters as input. If u don't pass any key by default it locks the whole table. If u pass the fields based on which u want the lock then only those records will be locked.

eg: Take example of VBAP where vbeln and posnr are the keys. When u lock the table based on vbeln all items will be locked. If u pass both vbeln and posnr only this line item record will be locked.

Hope it is clear.

Thanks,

Vinod.

Read only

Former Member
0 Likes
867

Hi Friend ,

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.

Hope this will give a basic idea.

Girish