Lock Objects

          Lock objects are use in SAP to avoid the inconsistency 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 your own lock on a object of SAP through transaction SE11 and enter any meaningful name start with EZ  OR EY .  For E.g EZLOCK_G.
When you create a lock object System automatically create two function module.
1. ENQUEUE_<Lock object name>. to insert the object in a queue.
2. DEQUEUE_<Lock object name>. To remove the object is being queued         
    through above FM.
You have to use these function module in your program. Transaction Code For Function Module is SE37.

For Example.

Create LOCK OBJECT  For Transparent Table .


 Step 1 . Go To Tcode SE11 . Select radio button View and Enter Name Of Lock
             Object Start  With EZ.
             


Step 2 . Enter Description . Go To Tab Tables . Enter Name of Transparent table .
            and Select Lock Mode From Drop Down Menu.
            




                       In Lock Parameter , It will Show all Primary key Fields.



Step 3. Check Lock Modules.

                          In Menu Bar , GoTo → Lock Modules.




                                     ENQUEUE & DEQUEUE is Created.




0 comments:

Post a Comment