‎2006 Jan 12 6:02 PM
hi folks,
Can anyone explain what is Locking in ABAP? How do you do it? Any examples would help me to understand this process.
Thanks in advance
Vinu
‎2006 Jan 12 6:06 PM
Hi,
FOR example if u r modifying one program ...no other user can modify the same program at the same time...till u come out os that program.
As that program is locked by you.
‎2006 Jan 12 6:06 PM
Hi,
FOR example if u r modifying one program ...no other user can modify the same program at the same time...till u come out os that program.
As that program is locked by you.
‎2006 Jan 12 6:08 PM
Hi Vinu,
When you are doing any modification to a table or its record then you need to lock the record so that there wont be any body else who will be allowed to modify the same record at the same time.
This you achieve by using the ENQUEUE & DEQUEUE function modules for the corresponding tables.
if its a custom table then you need to make the lock objects of your own through SE11.
Next is object lock which occurs when you were editing a report program and then the connection went off. In that case the object will be locked in the edit mode. This can be deleted from the transaction SM12.
What kind of table locks you can use is mentioned elaborately in help.sap.com
Cheers
JK
‎2006 Jan 12 6:14 PM
The concept of locks is closely related to the concept of transaction isolation. Transaction isolation makes sure that two simultaneously running transactions do not affect each other. Transaction isolation levels are realized by setting locks on read or changed rows in a database table.
Databases provide multiple isolation levels that determine how strong the isolation is between two simultaneously running transactions.
‎2006 Jan 12 6:31 PM
Hi vinu,
You can use these functional modules....
<b>BAL_DB_ENQUEUE</b>----
>Lock log
<b>ENQUEUE_ESFUNCTION</b>---->Lock an abap program so that it
cannot be executed.
<b>1. Example code for Database Locking...</b>
http://www.sapdevelopment.co.uk/dictionary/lock_enqueue.htm
<b>2. Help.Sap.Com</b>
http://help.sap.com/saphelp_nw04/helpdata/en/7b/f9813712f7434be10000009b38f8cf/content.htm
Hope it helps.
Regards,
Maheswaran.B
Message was edited by: Maheswaran B
‎2006 Jan 12 6:38 PM
Thank you folks for helping in understanding the process.
I have awarded the points accordingly.
Vinu
‎2006 Jan 12 8:56 PM
You should also know that locking is logical, not physical. Just because a program locks a table entry does not mean that no one can change that entry. Any program that tries to change a record should try to lock the record. If the lock fails, it generally means that the record is locked and that the program should not change it. But there is nothing actually preventing the program from making the change if the record is locked.
Rob
‎2006 Aug 04 2:54 PM
There are two types of lock for table update in SAP.
1.Database Lock
2.SAP Lock
Database Lock span to LUW(Logical Unit og Work)or to one dialog step while SAP lock can be extened to multuiple dilog steps in one tranaction.
As well database lock physically set with Open SQL statement like Select Single For Update,modify or insert while in case of SAP lock you have to set lock object exclusivly on row of database table.You have creat lock object on perticular database table and when you activate this object, it generate two funcion module ENQUEUE obj and DEQUEUE obj.By these function module you provide logical condition on which lock object set on database table.
‎2006 Aug 04 3:21 PM
Hi vinu,
The R/3 System synchronizes simultaneous access of several users to the same data records with a lock mechanism. When interactive transactions are programmed, locks are set and released by calling function modules (see Function Modules for Lock Requests). These function modules are automatically generated from the definition of lock objects in the ABAP Dictionary
Also check the link:
http://help.sap.com/saphelp_nw04s/helpdata/en/41/7af4c5a79e11d1950f0000e82de14a/content.htm
http://help.sap.com/saphelp_nw04s/helpdata/en/8e/c7430d53fd2548be18a291c27bd72e/content.htm
reward if helpful.
regards,
keerthi.