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

Database Locks

Former Member
0 Likes
537

Hi all,

can any one send a piece of code for locking.(shared,exclusive..)

Regards

vijaya

4 REPLIES 4
Read only

raja_thangamani
Active Contributor
0 Likes
495
Read only

Former Member
0 Likes
495

hello,

Lock

CALL FUNCTION 'ENQUEUE....'

EXPORTING

tabname = table_name

EXCEPTIONS

foreign_lock = 1

system_failure = 2

OTHERS = 3.

*-Unlock

CALL FUNCTION 'DEQUEUE...

EXPORTING

tabname = table_name

Regards,

shehryar

Read only

anversha_s
Active Contributor
0 Likes
495

hi,

Hi,

Lock objects are used to lock the database table while making the modifications on the database table.

you can create your own lock objects using SE11.

if you create lock objects on any table system will create two function modules.

1.ENQUEUE....

2.DEQUEUE.....

first one is used to lock the table

second one used to removing lock on the table.

*-------------lock Table
CALL FUNCTION 'ENQUEUE_E_TABLE'
EXPORTING
tabname = table_name
EXCEPTIONS
foreign_lock = 1
system_failure = 2
OTHERS = 3.
 
 
 
*-------------Unlock Table
CALL FUNCTION 'DEQUEUE_E_TABLE'
EXPORTING
tabname = table_name

check this link :

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

Rgds

Anver

<b><i>if hlped pls mark points</i></b>

Read only

Former Member
0 Likes
495

If you are working with HR Tables, Please use below FM's for enqueue / dequeue HR Objects..

<b>Unlock HR Objects</b> HR_DEQUEUE_OBJECT

<b>Lock HR Objects</b> HR_ENQUEUE_OBJECT

Regards,

Ramki.