Enqueue: Elem.lock 0 contains unpermitted lock mode /. lock object
Hello All,
SCM 5.0 system which is upgraded from 4.1:
System log entries contains:
<b>Enqueue: Elem.lock 0 contains unpermitted lock mode /. lock object /sapapo/E</b>
Work process log file contains :
LOG GE8===>0 /sapapo/E_MATLOC
I have gone through few notes like 606425, 447242.( lower version)
From which I came to the conclusion that it is program error.
Also group GE and No:8 What does it mean?
Please let me know your thoughts.Thanks.
Regards,
Tushar
Message was edited by:
Tushar Chavan
Message was edited by:
Tushar Chavan
Hi,
I found one more note :
Note 891372 - Lock entries for TemSe obj remain after completion of proc
The issue looks pretty similar. I think the notes you found are better suited for sap apo.
Log a call with SAP and check what they have to say.
Regards,
Siddhesh
Similar Messages
-
Hello Guru's,
we have a unusual problem in the syslog of our ERP System.
Enqueue: Elem.lock 0 contains unpermitted lock mode . lock object EZBEV_BO
We can't found any note or forum entry to solve this.
We checked SAP Notes: 1324099, 891372, 606425, 447242, 1260601 and searched in the forum, but nothing helpful found.
System Data:
ERP 6.0 / NW7.01 with EHP4
SAP Kernel : 701_REL
created on : Jan 18 2010 21:47:07
Kernel Patch number : 77
Source ID : 0.077
DBSL Patch No. : 075
Database
ORACLE 10.2.0.2
Operating System
AIX 5.3
Can someone help?
regards
Chrisdeveloper error
-
Enqueue/Dequeue - Locking/Unlocking object
Hi all,
Please help me working with this enqueue/dequeue command. What I'm trying to do is to lock a Service Order. My requirement is to do a BDC for the Service Order Settlement Rule. So after hitting SAVE, a secondary process will be kicked off to perform my BDC for the same order. Now what Im doubting is that what if user re-enter the same Service Order again so quick. So my BDC program will not be performed immediately since it will be locked by the usser.
So my idea is to lock it first while my BDC program is still running. Any help please? Thanks.Nope. Just 1 BDC -on my 2nd program only. Or to make it simple, I have modified ZXWOCU07 (IWO10009) to perform/kick off a call function( this is being triggered after hitting on SAVE). And this FM contains my checking if SO is now open for change then do the do the BDC.
What I'm thinking is to lock first the SO to block any user from accessing that SO, so it will do the BDC first. But I'm not yet familiar with the locking/unlocking of objects. Please help me on how to use enqueue or locking object. -
Where do I use These lock object FM's (Enqueue & D? and How do I use them?
I created lock object for user defined table (zconsist). The system automatically created 2 FM's (Enquiue & Dequeue).
I created a new TCode and accessing this with mulitple users to do some updates and inserts in that above table.
I used INSERT ZCONSIST statement in 5 places in my program (4 include programs).
Where do I use These FM's? and How do I use them?
I mean before inserting which FM I need to use? after immediately what fm used?.
every insert statemnt before i need to use the respective fm? so 5 places i need to call the respective FM is it right?
thank in advance.Hi Sekhar,
Lock objects are use in SAP to avoid the inconsistancy at the time of data is being insert/change into database.
SAP Provide three type of Lock objects.
Read Lock(Shared Locked)
protects read access to an object. The read lock allows other transactions read access but not write access to
the locked area of the table
Write Lock(exclusive lock)
protects write access to an object. The write lock allows other transactions neither read nor write access to
the locked area of the table.
Enhanced write lock (exclusive lock without cumulating)
works like a write lock except that the enhanced write lock also protects from further accesses from the
same transaction.
You can create a lock on a object of SAP thorugh transaction SE11 and enter any meaningful name start with EZ Example EZTEST_LOCK.
Use: you can see in almost all transaction when you are open an object in Change mode SAP could not allow to any other user to open the same object in change mode.
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.
check this link for example.
http://help.sap.com/saphelp_nw04s/helpdata/en/cf/21eea5446011d189700000e8322d00/content.htm
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.
Normally ABAPers will create the Lock objects, because we know when to lock and how to lock and where to lock the Object then after completing our updations we unlock the Objects in the Tables
http://help.sap.com/saphelp_nw04s/helpdata/en/cf/21eea5446011d189700000e8322d00/content.htm
purpose: If multiple user try to access a database object, inconsistency may occer. To avoid that inconsistency and to let multiple user give the accessibility of the database objects the locking mechanism is used.
Steps: first we create a loc object in se11 . Suppose for a table mara. It will create two functional module.:
1. enque_lockobject
1. deque_lockobject
before updating any table first we lock the table by calling enque_lockobject fm and then after updating we release the lock by deque_lockobject.
http://help.sap.com/saphelp_nw04/helpdata/en/cf/21eea5446011d189700000e8322d00/content.htm
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
Lock objects:
http://www.sap-img.com/abap/type-and-uses-of-lock-objects-in-sap.htm
http://help.sap.com/saphelp_nw04s/helpdata/en/cf/21eea5446011d189700000e8322d00/content.htm
Match Code Objects:
http://help.sap.com/saphelp_nw2004s/helpdata/en/41/f6b237fec48c67e10000009b38f8cf/content.htm
http://searchsap.techtarget.com/tip/0,289483,sid21_gci553386,00.html
See this link:
http://www.sap-img.com/abap/type-and-uses-of-lock-objects-in-sap.htm
Check these links -
lock objects
Lock Objects
Lock Objects
kindly reward if found helpful.
cheers,
Hema. -
Lock Object: Enqueue and Dequeue
Hi
Im using VB.Net, SAP .Net to do data entry, updates to
SAP R/3.
Now, I need to lock the data during user changes on
particular documents.
What I done is I created a lock object in SE11. Then
it produce 2 functions which are the ENQUEUE and
DEQUEUE.
Since the data reading from Non-SAP, I check for Allow
RFC and my lock mode is Exclusive and Cumulative.
After that, I also created a remote-enabled RFCs to be
call from VB.Net. These RFCs is calling the ENQUEUE
and DEQUEUE.
When I tested in SAP itself, the locking data is
working perfectly. I checked in SM12, it does shows
the locking entry.
But when I try in VB.Net and call the function
modules, it does not shows any entry in SM12. It is
like nothing happen at all.
After that, I do little test. Firstly I lock the data
from SAP then I run VB.Net, and it does shows the
message who is currently locking the data.
Anybody could help me on this?
Thank you.
Regards.See the following extract from documentation. Check if your lock object definition is satisfying all of them.
<i>Reference Fields for RFC-Enabled Lock Objects
The type of an RFC-enabled function module must be completely defined. The parameters of the generated function module therefore have the following reference fields for RFC-enabled lock objects:
Parameters Reference fields
X_<field name> DDENQ_LIKE-XPARFLAG
_WAIT DDENQ_LIKE-WAITFLAG
_SCOPE DDENQ_LIKE-SCOPE
_SYNCHRON DDENQ_LIKE-SYNCHRON
</i>
Here is the link to the documentation
http://help.sap.com/saphelp_46c/helpdata/en/4f/991f82446d11d189700000e8322d00/frameset.htm
Srinivas -
What exactly is the difference between enqueue,latch & lock
Can someone explain in simple words (with example if possible) what exactly is the difference between enqueue,latch & lock?
I have gone through documentation & other links,but just not able to figure out the exact & clear difference between these three..
Cheers,
KunwarIn addition to links provided by Sb and nice explanations by Aman, i would like to add below :
1.Latches and enqueues are lightweight serialization devices used to coordinate multi-user access to
shared data structures, objects and files.
Latches are locks that are held for extremely short periods of time, for example the time it takes to modify
an in-memory data structure. They are used to protect certain memory structures, such as the database
block buffer cache or the library cache in the shared pool (as described in Chapter 2, Architecture). Latches
are typically requested internally in a ‘willing to wait’ mode. This means that if the latch is not available,
the requesting session will sleep for a short period of time and retry the operation later. Other latches may
be requested in an ‘immediate’ mode, meaning that the process will go do something else rather than sit
and wait for the latch to become available. Since many requestors may be waiting for a latch at the same
time, you may see some processes waiting longer than others. Latches are assigned rather randomly, based
on the ‘luck of the draw’, if you will. Whichever session asks for a latch right after it was released will get it.
There is no line of latch waiters, just a ‘mob’ of waiters constantly retrying.
Oracle uses atomic instructions like ‘test and set’ for operating on latches. Since the instructions to set
and free latches are atomic, the operating system itself guarantees that only one process gets it. Since it
is only one instruction, it can be quite fast. Latches are held for short periods of time and provide a
mechanism for clean-up in case a latch holder ‘dies’ abnormally while holding it. This cleaning up
process would be performed by PMON.
Enqueues are another, more sophisticated, serialization device, used when updating rows in a database
table, fro example. They differ from latches in that they allow the requestor to ‘queue up’ and wait for
the resource. With a latch request, the requestor is told right away whether they got the latch or not.
With an enqueue, the requestor will be blocked until they actually attain it. As such, they are not as fast
as a latch can be, but they do provided functionality over and above that which a latch can offer.
Enqueues may be obtained at various levels, so you can have many ‘share’ locks and locks with various
degrees of ‘shareability’.
Source:Expert Oracle Database Architecture by Thomas Kyte
2.Good PPT at http://nocoug.org/download/2001-05/latches.ppt
3.Good PPT by Mark bobak at http://www.mi-oaug.org/Presentations/Understanding%20Locks%20and%20Enqueues.ppt
HTH
Girish Sharma -
Unable to delete Transport Request which contain locked objects
Hi all,
I need to delete some unusable transport requests but as they contain locked objects, it's not possible to delete them. Release operation is just allowed. After releasing these transport requests, I can not find them any more in queue. Please help to find these transport requests which are released and also provide a solution to delete instead of releasing them.
Thanks in advance,
Sanaz.Hi,
Thank you for the reply.
1. What do you mean by transport request , Shipment Request, Shipment Order or Tour.
A. I mean requests which can be transported between SAP Systems using TMS (Transport Management System).
2. What are the objects which has been locked and due to that you are facing this problem.
A. There are diffrent object types. For examle some customizing have booen done or SAP Note correction has been implemented, ... Therefore some objects have been locked due to these operations
3. Let's say if it's an freight Unit, then Pls confirm that System dump / error is not the cause for this.
A. I have no idea about "Freight Unit".
Thanks,
Sanaz. -
Hi friends,
<b>i am not able to edit my object in EP</b> , it says
Read-only mode. Object is currently locked by user: J2EE_ADMIN.
how do i unlock it ?
i am on 04s SP9Hi Rohit,
Navigate to
system_admin -> Monitoring->
Portal->object_locking->
There you can view your locked pcd object.Just check it and Unlock.
That should solve your problem.
Hope this helps
Regards
Vineeth -
What are the lock modes in Lock object
What are the lock modes in Lock object ?
what are the divfferences between
Exclusive , cumulative
Shared
Exclusive , not cumulative
Could any body explain what happens in each table lock ?
How the lock consists ?HI
Lock objects are used to synchronize access to the same data by more than one program.
The lock mode controls whether several users can access data records at the same time. The lock mode can be assigned separately for each table in the lock object. When the lock is set, the corresponding lock entry is stored in the lock table of the system for each table.
There are three types of lock modes
1.Exclusive
2.Shared
3.Exclusive not cummulative
Exclusive lock: The locked data can only be displayed or edited by a single user. A request for another exclusive lock or for a shared lock is rejected.
Shared lock: More than one user can access the locked data at the same time in display mode. A request for another shared lock is accepted, even if it comes from another user. An exclusive lock is rejected.
Exclusive but not cumulative: Exclusive locks can be requested several times from the same transaction and are processed successively. In contrast, exclusive but not cumulative locks can be called only once from the same transaction. All other lock requests are rejected.
please go through these links:
<a href="http://help.sap.com/saphelp_nw04/helpdata/en/a2/3547360f2ea61fe10000009b38f839/frameset.htm">http://help.sap.com/saphelp_nw04/helpdata/en/a2/3547360f2ea61fe10000009b38f839/frameset.htm</a>
<a href="http://help.sap.com/saphelp_nw04/helpdata/en/af/22ab01dd0b11d1952000a0c929b3c3/frameset.htm">http://help.sap.com/saphelp_nw04/helpdata/en/af/22ab01dd0b11d1952000a0c929b3c3/frameset.htm</a>
<a href="http://help.sap.com/saphelp_nw04/helpdata/en/cf/21eeb2446011d189700000e8322d00/frameset.htm">http://help.sap.com/saphelp_nw04/helpdata/en/cf/21eeb2446011d189700000e8322d00/frameset.htm</a>
<a href="http://help.sap.com/saphelp_nw04/helpdata/en/cf/21eebf446011d189700000e8322d00/frameset.htm">http://help.sap.com/saphelp_nw04/helpdata/en/cf/21eebf446011d189700000e8322d00/frameset.htm</a>
<a href="http://help.sap.com/saphelp_nw04/helpdata/en/cf/21eed9446011d189700000e8322d00/frameset.htm">http://help.sap.com/saphelp_nw04/helpdata/en/cf/21eed9446011d189700000e8322d00/frameset.htm</a>
Regards,
Gunasree. -
Hi,
Is there a way to manually release through Visual Admin for instance a locked resource on the Enqueue Server Lock Table?
Thanks in advance.No.
Later versions have such, but not in VA.
Regards,
Benny -
How to transport Enqueue and Dequeue Objects / Lock Objects / R3
Hi Gurus,
i have created two lock Objects.
I transported those objects in Q system but the table tab has no objects.
But in Dev every thing is correct.
Could you please indicate how i can get the objects correctly transported?
ThanksEasy and best approach is by getting them re transported by using transport of copy request (Type of request)
1) Get the Transport of copy request created by basis team / urself under your user.
2) Go to SE10 and highlight the request and click on include objects icon
3) Later in the pop up window select the radio button which mentions "Include free objects"
4) Then in the next screen mention the details based on the attributes of the Enque and deque object or else provide the package name and execute and in the next screen choose the concerned enque and deque objects and include them in the request.
5) Transport the Transport of copy to quality.
Also, more easiest is.
Find out the task of the request with with the enque and deque objects were created with (if more than one select all), and then include the tasks in the transport of copy and transport it to next system
If you are not able to do the above two steps then i think the object is $TMP object, kindly cross check.
Cheers -
Where we use lock objects in our coding like report
what is the purpose of lock objects s? how we use them in real time? like in devoloping reports?
Hi,,.
Lock objects are use in SAP to avoid the inconsistancy at the time of data is being insert/change into database.
SAP Provide three type of Lock objects.
- Read Lock(Shared Locked)
protects read access to an object. The read lock allows other transactions read access but not write access to
the locked area of the table
- Write Lock(exclusive lock)
protects write access to an object. The write lock allows other transactions neither read nor write access to
the locked area of the table.
- Enhanced write lock (exclusive lock without cumulating)
works like a write lock except that the enhanced write lock also protects from further accesses from the
same transaction.
You can create a lock on a object of SAP thorugh transaction SE11 and enter any meaningful name start with EZ Example EZTEST_LOCK.
Use: you can see in almost all transaction when you are open an object in Change mode SAP could not allow to any other user to open the same object in change mode.
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.
Check these links
Re: Lock Objects
http://help.sap.com/saphelp_47x200/helpdata/en/ce/931bb5c79911d5993e00508b6b8b11/frameset.htm
http://help.sap.com/saphelp_47x200/helpdata/en/e1/8e51341a06084de10000009b38f83b/frameset.htm
http://www.sapdevelopment.co.uk/dictionary/lock_enqueue.htm
http://help.sap.com/saphelp_nw04/helpdata/en/a2/3547360f2ea61fe10000009b38f839/frameset.htm
http://help.sap.com/saphelp_nw04s/helpdata/en/cf/21eea5446011d189700000e8322d00/content.htm
http://www.sap-img.com/abap/type-and-uses-of-lock-objects-in-sap.htm
http://help.sap.com/saphelp_nw04s/helpdata/en/cf/21eea5446011d189700000e8322d00/content.htm
Lock objects are use in SAP to avoid the inconsistancy at the time of data is being insert/change into database.
SAP Provide three type of Lock objects.
- Read Lock(Shared Locked)
protects read access to an object. The read lock allows other transactions read access but not write access to
the locked area of the table
- Write Lock(exclusive lock)
protects write access to an object. The write lock allows other transactions neither read nor write access to
the locked area of the table.
- Enhanced write lock (exclusive lock without cumulating)
works like a write lock except that the enhanced write lock also protects from further accesses from the
same transaction.
You can create a lock on a object of SAP thorugh transaction SE11 and enter any meaningful name start with EZ Example EZTEST_LOCK.
Use: you can see in almost all transaction when you are open an object in Change mode SAP could not allow to any other user to open the same object in change mode.
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.
Lock objects are use in SAP to avoid the inconsistancy at the time of data is being insert/change into database.
SAP Provide three type of Lock objects.
- Read Lock(Shared Locked)
protects read access to an object. The read lock allows other transactions read access but not write access to
the locked area of the table
- Write Lock(exclusive lock)
protects write access to an object. The write lock allows other transactions neither read nor write access to
the locked area of the table.
- Enhanced write lock (exclusive lock without cumulating)
works like a write lock except that the enhanced write lock also protects from further accesses from the
same transaction.
You can create a lock on a object of SAP thorugh transaction SE11 and enter any meaningful name start with EZ Example EZTEST_LOCK.
Use: you can see in almost all transaction when you are open an object in Change mode SAP could not allow to any other user to open the same object in change mode.
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.
http://help.sap.com/saphelp_nw04/helpdata/en/cf/21eea5446011d189700000e8322d00/content.htm
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
Lock objects:
http://www.sap-img.com/abap/type-and-uses-of-lock-objects-in-sap.htm
http://help.sap.com/saphelp_nw04s/helpdata/en/cf/21eea5446011d189700000e8322d00/content.htm
Match Code Objects:
http://help.sap.com/saphelp_nw2004s/helpdata/en/41/f6b237fec48c67e10000009b38f8cf/content.htm
http://searchsap.techtarget.com/tip/0,289483,sid21_gci553386,00.html
See this link:
http://www.sap-img.com/abap/type-and-uses-of-lock-objects-in-sap.htm
Lock objects are used to synchronize access to the same data by more than one program.
General information about the lock mechanism.
You can synchronize access by several programs to the same data with a logical lock mechanism. This lock mechanism fulfills two main functions:
A program can tell other programs which data records it is just reading or changing.
A program can prevent itself from reading data that is just being changed by another program.
When accessing data records, the records just being edited by other programs can be identified by the entry in the lock table. Such an entry for the lock must define a number of fully specified key fields, that is either a value is passed for the key field or this field is locked generically.
To set locks, a lock object must be defined in the ABAP Dictionary. When this lock object is activated, two function modules (see Function Modules for Lock Requests) are generated with the names ENQUEUE_<lockobjectname> and DEQUEUE_<lockobjectname>.
If data records are to be locked, you must call function module ENQUEUE_<lockobjectname>. The values of the key fields that specify the records to be locked are passed for all the tables contained in the lock object when the function module is called. There is a generic lock if a value is not passed for all the key fields. The function module writes the appropriate lock entry (see Example for Lock Objects). If another program also requests a lock, it will be accepted or rejected depending on the lock mode (see Lock Collisions). The program can then react to this situation.
Locked data records can be unlocked by calling function module DEQUEUE_<lockobjectname>. The key values and the lock mode used to set the lock must be passed to the function module.
Creating Lock Objects
Procedure
Select object type Lock object in the initial screen of the ABAP Dictionary, enter an object name and choose Create. The name of a lock object should begin with an E (Enqueue).
The maintenance screen for lock objects is displayed.
Enter an explanatory short text in the field Short text.
You can then use the short text to find the lock object at a later time, for example with the R/3 Repository Information System.
Enter the name of the primary table of the lock object.
All other tables in the lock object must be linked with the primary table using foreign keys. There are also some restrictions on the valid foreign key relationships.
Select the lock mode of the primary table in the field below it.
The lock mode is used as the default value for the corresponding parameters of the function modules generated from the lock object.
Choose Add if you want to lock records in more than one table with the lock object.
A list of all the tables linked with the primary table using valid foreign keys is displayed. Select the appropriate table. The lock mode of the primary table is copied as lock mode. You can change this setting as required, for example you can assign the lock mode separately for each table.
Similarly, you can add a table linked with the secondary table just added with foreign keys. To do this, place the cursor on the name of the secondary table and choose Add.
If no lock mode is assigned to a table, no lock is set for the entries in this table when the generated function modules are called. You should not assign a lock mode if a secondary table was only used to define a path between the primary table and another secondary table with foreign keys.
Save your entries.
A dialog box appears in which you have to assign the lock object a development class.
You can (optionally) exclude lock parameters (see lock objects) from the function module generation on the Lock parameter tab page. This makes sense for example if you always want to lock a parameter generically.
To do this, simply deselect the Weight flag for the parameter. The parameter is not taken into consideration in the generated function modules. This parameter is then always locked generically.
The name of a lock parameter is usually the name of the corresponding table field. If two fields with the same name are used as lock parameters in the lock object from different tables, you must choose a new name for one of the fields in field Lock parameter.
You can define whether the function modules generated from the lock object should be RFC-enabled on the Attributes tab page.
If you set the Allow RFC flag, the generated function modules can be called from within another system with Remote Function Call.
If you permit Remote Function Calls for an existing lock object, you must ensure that the generated function modules are called from within an ABAP program with parameters appropriate for the type. You should therefore check all programs that use the associated function modules before activating the lock object with the new option.
Choose .
Result
When you activate the lock object, the two function modules ENQUEUE_<lockobjectname> and DEQUEUE_<lockobjectname> are generated from its definition to set and release locks.
Regards
Vasu -
Let me know creation of lock object
let me know creation of lock object
Hi
<b>Lock Objects</b>
Lock object concept
Lock modes
Creating a lock object (example)
Lock object sample code
SAP data dictionary provides you with a locking mechanism to synchronize simultaneous data access by different users.
Lock objects are created in SE11.
Customer lock objects must begin with EY or EZ .
Three possible lock modes exist for lock objects.
<b>Lock Mode</b>
Lock mode E: This sets a lock for changing data for single user. This lock can be accumulated.
Lock mode X: This mode is used like mode E for changing data. The only technical difference from mode E is that the respective lock does not allow accumulation.
Lock mode S: This mode ensures that data displayed in your program cannot be changed by other users during the entire display time. Here you do not want to change the data yourself (allows read only access for data).
<b>Creating Lock object</b>
SE11
1)Enter lock object name beginning with EY or EZ
and hit create.
2)Enter table names containing data records that should be locked and the lock mode.
Enter short text /tbale/lockmode.
3) The primary keys of the specified tables are automatically selected as lock parameters.
It automatically selects the primary key for the selected table.
To set a lock in the application program
call a function module ENQUEUE_<LOCK_OBJECT>.
For our example, it would be ENQUEUE_EZMARA.
To release the lock in the application program
call a function module DEQUEUE_<LOCK_OBJECT>.
For our example, it would be DEQUEUE_EZMARA.
Refer the code executed by user (say abap1) for
matnr = 000000000000000012.
Lock Objects are used to synchronize access to the same data by more than one user. Function modules that can be used in application programs are generated from the definition of a lock object in the ABAP Dictionary.
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 .These function modules are automatically generated from the definition of lock objects in the ABAP Dictionary.
Structure of a Lock Object
The tables in which data records should be locked with a lock request are defined in a lock object together with their key fields.
When tables are selected, one table (the primary table) is first selected. Further tables (secondary tables) can also be added using foreign key relationships.
Lock Arguments
The lock argument of a table in the lock object consists of the key fields of the table.
The lock argument fields of a lock object are used as input parameters in the function modules for setting and removing locks generated from the lock object definition. When these function modules are called, the table rows to be locked or
unlocked are specified by defining certain values in these fields.These values can also be generic. The lock argument fields therefore define which subset of the table rows should be locked
Data Dictionary/ Lock Objects
The simplest case of a lock object consists of exactly one table and the lock argument of the table is the primary key of this table. Several tables can also be included in a lock object. A lock request therefore can lock an entire logical
object, and not only a record of a table. Such a logical object can be for example a document comprising an entry in a header table and N entries in a positiontable.
Lock Mode
The lock mode controls whether several users can access data records at the same time. The lock mode can be assigned separately for each table in the lock object. When the lock is set, the corresponding lock entry is stored in the
lock table of the system for each table. Access by more than one user can be synchronized in the
following ways:
Exclusive lock: The locked data can only be displayed or
edited by a single user. A request for another exclusive lock
or for a
shared lock is rejected.
Shared lock: More than one user can access the locked data
at the same time in display mode. A request for another
shared lock is accepted, even if it comes from another user. An exclusive lock
is rejected. Exclusive but not cumulative: Exclusive locks can be requested
several times from the same transaction and are processed
successively. In contrast, exclusive but not cumulative locks
can be called only once from the same transaction. All other
lock requests are rejected.
1) Select object type Lock object in the initial screen of the ABAP Dictionary, enter an object name and choose Create. The name of a lock object should begin with an E (Enqueue).The maintenance screen for lock objects is displayed.
2) Enter an explanatory short text in the field Short text. You can then use the short text to find the lock object at a later time, for example with the R/3 Repository Information System.
3) Enter the name of the primary table of the lock object. All other tables in the lock object must be linked with the primary table using foreign keys.
4) Select the lock mode of the primary table in the field below it The lock mode is used as the default value for the corresponding parameters of the function modules generated from the lock object.
5) Choose Add if you want to lock records in more than one
table with the lock object. A list of all the tables linked with the primary table using valid foreign keys is displayed. Select the appropriate table. The lock
mode of the primary table is copied as lock mode. You can change this setting as required, for example you can assign the lock mode separately for each table.
Similarly, you can add a table linked with the secondary table just added with foreign keys. To do this, place the cursor on the name of the secondary table and choose Add.
If no lock mode is assigned to a table, no lock is set for the
entries in this table when the generated function modules are
called. You should not assign a lock mode if a secondary table
was only used to define a path between the primary table and
another secondary table with foreign keys.
6) Save your entries.
A dialog box appears in which you have to assign the lock
object a development class.
7) You can define whether the function modules generated from
the lock object should be RFC-enabled on the Attributes tab
page. If you set the Allow RFC flag, the generated function
modules can be called from within another system with Remote
Function Call. If you permit Remote Function Calls for an
existing lock object, you must ensure that the generated
function modules are called from within an ABAP program with
parameters appropriate for the type. You should therefore check
all programs that use the associated function modules before
activating the lock object with the new option.
8) Choose Activate
<b>Reward if u sefull</b> -
I've a TCode to modify a report. That TCode picks a doc no. from a table & opens up an editable ALV based on that doc. no .That doc. no. is the only primary key.
I want that if someone is already opened that report, & if someoen else is trying to open that report, it shouldn't open & should show that -"its locked by User XXX". I've made a lock object for that table. Please advise what to do next. How to populate the User name who has locked the report.used ENQUEUE function and DEQUEUE function
Function Modules for Lock Requests
Activating a lock object in the ABAP Dictionary automatically creates function modules for setting (ENQUEUE_<lock object name>) and releasing (DEQUEUE_<lock object name>) locks.
The generated function modules are automatically assigned to function groups. You should not change these function modules and their assignment to function groups since the function modules are generated again each time the lock object is activated.
Never transport the function groups, which contain the automatically generated function modules. The generated function modules of a lock object could reside in a different function group in the target system. Always transport the lock objects. When a lock object is activated in the target system, the function modules are generated again and correctly assigned to function groups.
Parameters of the Function Modules
Field Names of the Lock Object
The keys to be locked must be passed here.
A further parameter X_<field> that defines the lock behavior when the initial value is passed exists for every lock field <field>. If the initial value is assigned to <field> and X_<field>, then a generic lock is initialized with respect to <field>. If <field> is assigned the initial value and X_<field> is defined as X, the lock is set with exactly the initial value of <field>.
Parameters for Passing Locks to the Update Program
A lock is generally removed at the end of the transaction or when the corresponding DEQUEUE function module is called. However, this is not the case if the transaction has called update routines. In this case, a parameter must check that the lock has been removed.
Parameter _SCOPE controls how the lock or lock release is passed to the update program (see The Owner Concept for Locks). You have the following options:
キ _SCOPE = 1: Locks or lock releases are not passed to the update program. The lock is removed when the transaction is ended.
キ _SCOPE = 2: The lock or lock release is passed to the update program. The update program is responsible for removing the lock. The interactive program with which the lock was requested no longer has an influence on the lock behavior. This is the standard setting for the ENQUEUE function module.
キ _SCOPE = 3: The lock or lock release is also passed to the update program. The lock must be removed in both the interactive program and in the update program. This is the standard setting for the DEQUEUE function module.
Parameters for Lock Mode
A parameter MODE_<TAB> exists for each base table TAB of the lock object. The lock mode for this base table can be set dynamically with this parameter. The values allowed for this parameter are S (read lock), E (write lock), X (extended write lock), and O (optimistic lock).
The lock mode specified when the lock object for the table is created is the default value for this parameter. This default value can, however, be overridden as required when the function module is called.
If a lock set with a lock mode is to be removed by calling the DEQUEUE function module, this call must have the same value for the parameter MODE_<TAB>.
Controlling Lock Transmission
Parameter _COLLECT controls whether the lock request or lock release should be performed directly or whether it should first be written to the local lock container. This parameter can have the following values:
キ Initial Value: The lock request or lock release is sent directly to the lock server.
キ X: The lock request or lock release is placed in the local lock container. The lock requests and lock releases collected in this lock container can then be sent to the lock server at a later time as a group by calling the function module FLUSH_ENQUEUE.
Whenever you have lock mode X (extended write lock), locks should not be written to the local lock container if very many locks refer to the same lock table. In this case, there will be a considerable loss in performance in comparison with direct transmission of locks.
Behavior for Lock Conflicts (ENQUEUE only)
The ENQUEUE function module also has the parameter _WAIT. This parameter determines the lock behavior when there is a lock conflict.
You have the following options:
キ Initial Value: If a lock attempt fails because there is a competing lock, the exception FOREIGN_LOCK is triggered.
キ X: If a lock attempt fails because there is a competing lock, the lock attempt is repeated after waiting for a certain time. The exception FOREIGN_LOCK is triggered only if a certain time limit has elapsed since the first lock attempt. The waiting time and the time limit are defined by profile parameters.
Controlling Deletion of the Lock Entry (DEQUEUE only)
The DEQUEUE function module also has the parameter _SYNCHRON.
If X is passed, the DEQUEUE function waits until the entry has been removed from the lock table. Otherwise it is deleted asynchronously, that is, if the lock table of the system is read directly after the lock is removed, the entry in the lock table may still exist.
Exceptions of the ENQUEUE Function Module
キ FOREIGN_LOCK: A competing lock already exists. You can find out the name of the user holding the lock by looking at system variable SY-MSGV1.
キ SYSTEM_FAILURE: This exception is triggered when the lock server reports that a problem occurred while setting the lock. In this case, the lock could not be set.
If the exceptions are not processed by the calling program itself, appropriate messages are issued for all exceptions.
Reference Fields for RFC-Enabled Lock Objects
The type of an RFC-enabled function module must be completely defined. The parameters of the generated function module therefore have the following reference fields for RFC-enabled lock objects:
Parameters
Reference fields
X_<field name>
DDENQ_LIKE-XPARFLAG
_WAIT
DDENQ_LIKE-WAITFLAG
_SCOPE
DDENQ_LIKE-SCOPE
_SYNCHRON
DDENQ_LIKE-SYNCHRON
See also:
Example for Lock Objects
http://help.sap.com/saphelp_nw04/helpdata/en/cf/21eebf446011d189700000e8322d00/content.htm -
Lock object not working.
Hi,
I am trying to create a lock object.
Having following doubts:
1) In one program, ENQUEUE function for that lock object But DEQUEUE function is not called. So the record on which the ENQUEUE function is called will remain locked for ever or only till the program ends?
2) 1 program ZXYZ has ENQUEUE function on one record...But it has not DEQUEUE function in it....... second program ZXYZ1 is trying to edit that record....what should happen??
According to me, that second program should not be able to edit it until the table has given record to DEQUEUE function. Correct me if I am wrong.
But in these programs, Second program is able to edit the record locked by the first program. This is true if Lock Mode of the Lock object is Read Lock/Write Lock /Exclusive, Not cumulative.
Please let me know your valuable inputs.
Regards,
PoojaHi ,
Thanks for all your replies.
Please find below both the programs. SY-SUBRC is zero in both the programs.
Let me know if anything is wrong in the code. Commit work is not used anywhere in the program explicitly.
*First Program: *
REPORT ztestxyz.
TABLES: zcrossref.
DATA: wa_zcrossref TYPE zcrossref.
wa_zcrossref-business_unit = 'TOPS'.
wa_zcrossref-conversion_type = 'KS'.
wa_zcrossref-legacy_code = '0314'.
wa_zcrossref-sap_code = '0314'.
CALL FUNCTION 'ENQUEUE_EZTEST'
EXPORTING
mode_zcrossref = 'E'
client = sy-mandt
business_unit = wa_zcrossref-business_unit
conversion_type = wa_zcrossref-conversion_type
legacy_code = wa_zcrossref-legacy_code
x_business_unit = ' '
x_conversion_type = ' '
x_legacy_code = ' '
_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.
ELSE.
WRITE: 'Sucessful.' .
UPDATE zcrossref FROM wa_zcrossref.
WAIT UP TO 20 SECONDS.
ENDIF..
Second program:
REPORT ztestxyz1.
*DATA: wa_loan TYPE zloandeposit.
*wa_loan-xblnr = 'FWD3939'.
*wa_loan-doctyp = 'AB'.
*MODIFY zloandeposit FROM wa_loan.
Data: wa_zcrossref type zcrossref.
wa_zcrossref-business_unit = 'TOPS'.
wa_zcrossref-conversion_type = 'KS'.
wa_zcrossref-legacy_code = '0314'.
wa_zcrossref-sap_code = 'XYZ2'.
UPDATE zcrossref FROM wa_zcrossref.
IF sy-subrc = 0.
WRITE: 'Succesful.!!'.
ELSE.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
Regards,
Pooja
Maybe you are looking for
-
How can I change the name associated with an email address?
I assumed an existing account but would like to change the tag name associated with it. Right now it is still showing up as a colleague's name.
-
Will the iphone 5 have better Bluetooth capability?
All current iPhones are very limited. Specifically my car will notify me of new SMS and read SMS out loud with most smart phones but not with any iPhone because of their limited Bluetooth file transfer capability. I've seen lots of posts complainin
-
Extractor forl purchase requisition
hello all, i need to loading all purchase requisition from ECC to BW which extractor do this ? adition, at bw we have the standart cube 0PUR_C01((with extractors2LIS_02_ITM+SCL) + 0PUR_C04 (with extractors 2LIS_02_HDR+ ITM+SCL). at query i need accou
-
Custom evaluation of EL expressions - extend ExpressionEvaluator?
I have a model class (corresponding to a database table) with some exclusion flags, where the flags indicated that a field should not be displayed on a page where we choose to apply exclusions. For example, a person may request that their username an
-
Novice needing help PSD vs JPEG
I am changing from PSE8 to PSE12 and realized upon trying 12 today that PSE12 automatically saves my edited pictures in PSD format where PSE8 saved them in JPEG. I don't use the organizer for catalogs, instead opening up folders where I've saved my