2009 Nov 03 8:54 AM
HI All ,
I want to lock the Exclusive lock for table ,i.e in the process try to lock all the table for
update issue , how can i do that ,i read the help but i don't find where i can lock that all table .
by the way its recommended to lock the all table before update since
i want to use modify ZDB_table from table itab.
Regards
Chris
HI All ,
I want to lock the Exclusive lock for table ,i.e in the process try to lock all the table for
update issue , how can i do that ,i read the help but i don't find where i can lock that all table .
by the way its recommended to lock the all table before update since
i want to use modify ZDB_table from table itab.
Regards
Chris
2009 Nov 03 8:59 AM
Hello,
You can make use of DEQUEUE_E_TABLEE / ENQUEUE_E_TABLEE for locking the entire table.
BR,
Suhas
2009 Nov 03 9:07 AM
Don't understand what your requirements are... If you just need to update a DB Z table from an itab, you should not deal with a lock management since that's assured by the way the system works with DB tables; an update/mod access to a DB table automatically prevents concurrent mod. access to avoid inconsistencies.
You might want to check before any DB access if a certain DB table is in a lock queue. Have a look at this FM: ENQUEUE_READ.
Hope this helps
2009 Nov 03 9:19 AM
You may
- lock the whole table SM30 like via lock object E_TABLE or E_TABLEE
CALL FUNCTION 'ENQUEUE_E_TABLE'
EXPORTING
tabname = 'MARA'
EXCEPTIONS
foreign_lock = 1.- lock the whole set of keys using a wildcard key via the lock object assiociated to records of the table
CALL FUNCTION 'ENQUEUE_EMMARAE'
EXPORTING
mandt = sy-mandt
* MATNR = " generic value will lock whole table
EXCEPTIONS
foreign_lock = 1
system_failure = 2
OTHERS = 3.But be aware that the lock tools will only lock vs other reports using the same logic/FM. (chek in SM12)
Also read documentation like [The SAP Lock Concept (BC-CST-EQ) |http://help.sap.com/saphelp_nw70/helpdata/en/c2/2d7037ecc92a7ee10000009b38f8cf/frameset.htm] and samples like [Example Program: SAP Locking|http://help.sap.com/saphelp_nw70/helpdata/en/41/7af4c8a79e11d1950f0000e82de14a/frameset.htm]
Regards,
Raymond
2009 Nov 03 10:57 AM
HI Raymond ,
i need lock the table since there is process that read data from the table (via paging process i.e 1000 records in one request ) and
this read process can take more than hour so to avoid inconsistency i need to use locking concept
do u think that i need to use the lock for all the table for update (like ENQUEUE_E_TABLE )
and for read process to use read lock
what do u think ?
BR
Chris
2009 Nov 03 12:38 PM
You must lock the table the same way that the other processes use to update the table, if they lock by records use the enqueue object associated to the table, if they lock the table via lock object E_TABLEE use this one, if they perform wild update of the table, no luck. You have to look for other processes which update the table. (try SM12 to watch)
If this is the only program that update the table, use ENQUEUE_E_TABLEE so only one instance will be able to lock the file.
Regards,
Raymond
2009 Nov 03 9:22 AM
hai,
as per your requirement before you update data into database table it should be locked for that use function module Enque. after the updation you should release the lock with Deque function module. use sy-subrc if data is getting updated then only table should get locked.
to check wether table is locked or to release any lock if necessary go to t-code sm12.
2009 Nov 03 9:56 AM
| User | Count |
|---|---|
| 4 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |