07-30-2007 5:01 AM
i want to lock the data base table recors while i am changin in one transaction....
07-30-2007 5:02 AM
Hi
Create a lock object in SE11 on the table .
it automatically creates two function module with the name
ENQUEUE_lockobjectname and DEQUEUE_lockobjectname .
Call Enqueue function module to lock the database records
and Dequeue function module to release the lock .
Please reward all helpfull answers
07-30-2007 5:43 AM
Hi,
You can create a lock on a object of SAP thorugh transaction SE11 and enter any meaningful name start with EZ Example EZTEST_LOCK.
This will autogenerate two function modules,Enqueue < lock object > and Dequeue < lock object >
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.
Eg:
tables:vbak.
call function 'ENQUEUE_EZLOCK3'
exporting
mode_vbak = 'E'
mandt = sy-mandt
vbeln = vbak-vbeln
X_VBELN = ' '
_SCOPE = '2'
_WAIT = ' '
_COLLECT = ' '
EXCEPTIONS
FOREIGN_LOCK = 1
SYSTEM_FAILURE = 2
OTHERS = 3
.
if sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
endif.
<b>TO LOCK</b>
Execute CALL FUNCTION statement
CALL FUNCTION " ENQUEUE <lock object ">
EXPORTING . . .
EXCEPTIONS . . .
CASE SY-SUBRC.
.
ENDCASE.
<b>TO UNLOCK</b>
Execute the CALL FUNCTION statement
CALL FUNCTION 'DEQUEUE <lock object >'
EXPORTING . .
It is important to unlock the entry so others can update it.
Regards,
Padmam.
07-30-2007 5:44 AM
Hi,
Close the Thread if it solved ur Problem.
Thanks & Regards,
Padmam.
07-30-2007 5:47 AM