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: 

Locking in ABAP

Former Member
0 Kudos

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

1 ACCEPTED SOLUTION

Former Member
0 Kudos

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.

8 REPLIES 8

Former Member
0 Kudos

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.

Former Member
0 Kudos

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

Former Member
0 Kudos

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.

Former Member
0 Kudos

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

Former Member
0 Kudos

Thank you folks for helping in understanding the process.

I have awarded the points accordingly.

Vinu

0 Kudos

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

Former Member
0 Kudos

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.

Former Member
0 Kudos

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.