10-06-2008 6:17 PM
Gurus,
I ant to lock a table DMS_LO_CD1 and then do certain upodate and then release the lock after that.
How can I d this ?
Thanks.
Regards,
Rajesh.
10-06-2008 6:25 PM
* Lock the table
CALL FUNCTION 'ENQUEUE_E_TABLE'
EXPORTING
mode_rstable = 'E'
tabname = p_table
EXCEPTIONS
foreign_lock = 1
system_failure = 2
OTHERS = 3.
IF sy-subrc = 0.
* Modify the database table with these changes
MODIFY (p_table) FROM TABLE <dyn_tab_temp>.
REFRESH <dyn_tab_temp>.
* Unlock the table
CALL FUNCTION 'DEQUEUE_E_TABLE'
EXPORTING
mode_rstable = 'E'
tabname = p_table.
ENDIF.
10-06-2008 6:25 PM
* Lock the table
CALL FUNCTION 'ENQUEUE_E_TABLE'
EXPORTING
mode_rstable = 'E'
tabname = p_table
EXCEPTIONS
foreign_lock = 1
system_failure = 2
OTHERS = 3.
IF sy-subrc = 0.
* Modify the database table with these changes
MODIFY (p_table) FROM TABLE <dyn_tab_temp>.
REFRESH <dyn_tab_temp>.
* Unlock the table
CALL FUNCTION 'DEQUEUE_E_TABLE'
EXPORTING
mode_rstable = 'E'
tabname = p_table.
ENDIF.
10-06-2008 6:25 PM
Rajesh,
you can try to create a lock object for this table and then call the function modules that get generated for locking and unlocking the table.
MGS.
10-06-2008 6:27 PM
Hi,
There are two function modules used to lock and unlock the tables. Those are mentioned below.
Unlocking the table
CALL FUNCTION 'DEQUEUE_E_TABLE'
EXPORTING
tabname = table_name
locking the table
CALL FUNCTION 'ENQUEUE_E_TABLE'
EXPORTING
tabname = table_name
EXCEPTIONS
foreign_lock = 1
system_failure = 2
OTHERS = 3.
Regards,
Midhun Abraham
10-06-2008 6:59 PM
How can I create a lock object for a table ? How can I see the lock objects created for the table ?
Regards,
Rajesh.
10-06-2008 7:02 PM
http://help.sap.com/saphelp_nw04/helpdata/en/cf/21eea5446011d189700000e8322d00/content.htm
https://forums.sdn.sap.com/click.jspa?searchID=115258&messageID=2656474
Do the following steps..
GO TO SE11
Select the radio button "Lock object"..
Give the name starts with EZ or EY..
Example: EYTEST
Press Create button..
Give the short description..
Example: Lock object for table ZTABLE..
In the tables tab..Give the table name..
Example: ZTABLE
Save and generate..
Your lock object is now created..You can see the LOCK MODULES..
In the menu ..GOTO -> LOCK MODULES..There you can see the ENQUEUE and DEQUEUE function
Hope this helps.
Regards,
Midhun Abraham
10-06-2008 7:27 PM
Please create a lock object as described by Midhun. To check if there is a lock object for your table follow the steps below
Display the table contents for table DD25L with the selection criteria ROOTTAB = 'Your Table Name' and AGGTYPE = 'E'.
10-06-2008 7:52 PM
Hello,
I have found the lock objects. Can someone tell me if I transport lock objects from one system to other the lock function modules also get transported ?
Regards,
Rajesh.