Synchronization parameter in lock object
what if we give initial value to this parameter ,the lock deleted asynchronously ,
i am not getting the meaning of asynchronously
hi,suruchi
i m asking
if lock 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.
Consider a scenario if we delete the lock ansynchronously is the lock deleted,
or some time later if some other user wants to use the same lock object they
can lock it or not?or what are the disadvantage of deleting lock asynchronously?
Thanks for response
Similar Messages
-
Parameter _SCOPE in lock object
Hi,
How the scope parameter behaves for the lock object ,means if we pass scope =1
wat is this mean ,and what are the possible values that we give to this parameterHii Tarun..
This comes under Database Updates Concept in SAP.
Let me give u basic idea.
V1 V2 Updates are processed by Update Work processes .
V1 - Means Critical updates which runs under locking
V2 - Means Non Critical updates which runs without locking
For this we use the statement
We will create/use a FM in SE37 with Processing type Update module.
And this function is called using
CALL FUNCTION 'FM' IN UPDATE TASK
Only in this scenario the _SCOPE parameter in Lock objects modules will work differently .
Otherwise you need not to bother about this parameter.
<b>Reward if Helpful</b><b></b> -
Configuring profile parameter for a table lock object
Hi Experts-
I want to set the 'wait time' (_WAIT) parameter as a profile parameter for a table lock object.
I have created a lock object on a ZTable. I lock and unlock this object in exclusive non-cumulative mode through the enqueue and dequeue lock object function modules. These generated FMs are invoked via my custom function module.
My function module will run in the background as a scheduled task in R/3. I execute the Enqueue FM at the start of the FM and keep the table locked until the last step finishes in my FM and then I Dequeue it. I want to have the processing wait and retry the Enqueuring FM at set intervals in case the one run doesn't finish entirely and a new run of this same job kicks off.
Thank you,
- Vik.Set the wait parameter = 'X'. These means that if it encounters a lock, then it will wait a certain time for the lock to be released. This certain time is a system value set by your basis team. I don't imagine it being a very long time.
CALL FUNCTION 'ENQUEUE_EZPIPHYINVREF'
EXPORTING
MODE_ZPIPHYINVREF = 'E'
MANDT = SY-MANDT
_WAIT = 'X'.
Regards,
Rich Heilman -
Modifying locked object of a synchronization block
Hi everyone,
Does someone know what happens if an object used as lock in a synchronization block, is modified into the same block?
Look to the belowe example to clarify my question:
Object out is modified into the synchronization block: other threads that try to executed another synchonization block (with out as lock object) become able to execute it because now the reference is changed?
Thank you very much in advance.
Diego
synchronized (out) {
try {
out = new PrintStream (new FileOutputStream (file));
out.println ();
} catch (FileNotFoundException e) {
.................DiegoCarzaniga wrote:
Thank you very much Kajbj.
This means that JAVA synchronization uses object references to implement locks... is it correct?No. A monitor lock is associated with an instance and not with the reference to an instance.
E.g.
Object lock = new Object();
Object sameLock = lock;Here lock and sameLock are referencing the same object and that object only has one monitor so you can either synchronize on lock or sameLock (but I would advise against it since it might cause confusion)
Kaj -
Different _scope parameter of Enqueue_ lock object and Dequeue_ lock objec
Hi, all.
When we create lock object and generate enqueue_<lock object> and
dequeue_<lock object>, the default value of _scope is
enqueue : _scope = 2(update owner only)
dequeue : _scope = 3(for both dialog owner and update owner).
Does anyone tell me the reason of this different default values?
i read help.sap.com - lock related help but i couldn't get the idea
of these different default values between enqueue and dequeue.
Best Regards.
SejoonHi,
When you use ENQUEUE, the owner is going to lock that record. So at that time, the only person who can modify the record in the one who has locked it using ENQUEUE. So only he needs to be informed.
Whereas when you use DEQUEUE, the owner who has locked the record and processed it + the 2nd user who wants to lock it needs to be informed. Hence it is to update the 1st User(who has done the update and planning to release the lock) + 2nd User(who wants to do the update and planning to lock the record ).
Best regards,
Prashant -
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 -
Create lock object with fun command
Hallo,
Is it possible to create a lock object with the fun command? I tried to use:
FUN ( ENQUEUE _<lockobject> , <interface> ).
When I fill the importing parameters, execute the script and afterwards refresh the interace than the import parameters are empty. Is there a way to create a lock object with the fun command or at least with inline abap?
regards,
WolfgangHi Wolfgang,
in general your way of including the FUN command was correct.
The loss of import parameter values must have been caused by some other reason, not related to the invoke of enqueue. Maybe try it again.
If, for any reason, using FUN is not possible, it's always an alternative to use ABAP. .... ENDABAP. with correct ABAP coding inbetween (e.g. CALL FUNCTION ...).
Nevertheless regarding enqueue you need to consider, that the lock you set by running eCATT test scripts in this way, will last (only) as long as the session in which the function was called is active. Means, it lasts as long as you do not close the SECATT transaction (/n or similar) and not use commands like RESCON in your test script. Check your locks with transaction sm12.
Be aware, that interfering with an applications lock handling and strategy might also harm running transactions or the data processed by this transactions. Usually there is no need to call the enqueue modules from a test.
Best Regards
Jens -
HI All
i am want to handle lock object for instance if i want to lock some object and it's already locked i want to do some loop on it for 5 times .
1. i need to know if what i was doing is OK since this is my first time .
2. what should i use i parameter wait can it help me ?
Kind Regards
Chris
iv_try_x_times = 5. "this value on the method signature
DO iv_try_x_times TIMES.
lv_count = lv_count + 1.
CALL FUNCTION ENQUEUE_USR_DATA
EXPORTING
mandt = sy-mandt
userid = mv_userid
x_for_user = iv_is_exact
_wait = iv_is_wait
EXCEPTIONS
foreign_lock = 1
system_failure = 2
OTHERS = 3.
IF sy-subrc = 0.
RETURN.
ENDIF.
IF lv_count < iv_try_x_times.
WAIT UP TO 1 SECONDS.
ENDIF.
ENDDOHi Chris,
Such a code piece might help you;
data: is_locked type c,
lv_counter type i.
is_locked = ''.
lv_counter = 0.
while is_locked = '' and lv_counter < 5.
lv_counter = lv_counter + 1.
CALL FUNCTION ENQUEUE_USR_DATA
EXPORTING
mandt = sy-mandt
userid = mv_userid
x_for_user = iv_is_exact
_wait = iv_is_wait
EXCEPTIONS
foreign_lock = 1
system_failure = 2
OTHERS = 3.
IF sy-subrc = 0.
is_locked = 'X'.
else.
wait up to 1 seconds.
endif.
endwhile.
Regards;
Ozcan. -
How to create a lock object dynamically ?
Hi all,
I have a report with a selection screen having one parameter in which the user can put a table name(Custom table) and some other paremeters.Based on these parameters I need to delete records from table put on the selection screen.Before deeting I need to lock the table. As beforehand I dont know the table name how can I create lock object dynamically lock my table ?
Please suggest some idea...Hi,
check below link
lock objects
http://help.sap.com/erp2005_ehp_03/helpdata/EN/7b/f9813712f7434be10000009b38f8cf/frameset.htm
Regards,
Madhu -
How to create a lock object in se11
hi all,
Can anyone tell me the step by step procedure to lock as well as unlock a particular object in se11 trns code. with an real time example.
thanxs in advance
hariHi,
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.
Creating Lock Objects
Procedure
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. There are also some restrictions on the valid foreign key relationships.
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.
6.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.
7.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.
8.Save your entries.
A dialog box appears in which you have to assign the lock object a development class.
9.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.
9.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.
10.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.
11.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.
12 .Choose Activate .
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.
You can find information about the activation flow in the activation log, which you can display with Utilities Activation log. If errors occurred during activation, the activation log is displayed immediately.
Pls reward points.
Regards,
Ameet
Message was edited by:
Ameet Jassani -
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. -
Auto Unlocking of locked objects in SM12
Hi All,
Is there a way that all the object locked in TCODE SM12 for over say 1 or 2 hours, gets unlocked automatically.
Any RZ10 parameter or via some other means.
I searched but couldn't get anything on the same.
Does anyone has some ideas on this. Please share, will be highly obliged.
Thanks & REgards,
AshutoshHello Ashutosh
It would be a bad idea to auto cleanup locks in transaction SM12. Those locks have a purpose to keep your data consistent.
If you have issues that locks are set and cause issues for other users you should check where the locks come from and take action on it.
Setting different type of timeouts could help in some cases (as indicated above) to prevent users from leaving their screens in the middle of a transaction, possibly locking objects. User awareness can also help out (restricting reporting to the neccesary data and not requesting data from 10 years ago.
Do you currently have lock issues? If yes you can post on SDN to get some help on those.
Kind regards
Tom -
Hello All ,
I have create one Module Pool program.it is having three t code for creation ,change and display. it is having two table Header and details table.
I have decided to go for shared lock as per requirement. That's why created on lock object with the help of t code se11 .
My problem is how do I call that lock object in program, because all the lock object are called using called function PATTERN. When I am also trying to do the same it give me message function not found.
Can some one tell me :
1 . How do I called lock object in my program.
2. Lock object : lock parameter are there ,Means the primery key of lock object on the logic of this the lock object is called.
3. would the same lock I can called for Create and change also. Would i work ?. At the same time other operation can perform.
Please provide me the ansower of the question.
regards
Swati namdeoHi
Hope it will help you.
Pls reward if help.
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 -
Hi,
Iam implementing some screens. I created some lock objects. I could not able to under these concepts. Even though I studied some documents, i could not get the below concepts. can anybody explain.
1. what is the enqueue mode
2. what is the scope
3.what is the wait parametrs
rgds
p.kpHi paluri,
Info taken from standard sap help.
1. Enqueu 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.
2. Scope
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 and 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.
3. WAIT
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.
regards,
amit m. -
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>
Maybe you are looking for
-
How do I get a video I shot with my iphone into iMovie on my iPad?
I can see it in the cloud, but I don't see an option to download it for local editing on my ipad. In iMovie there is a cloud option for media but it only shows an iMovie folder. So how do I get the media I shot with iPhone from the cloud to my iPad f
-
hello i tried enabling dotnet feature in windows 8 but error message appeared Deployment Image Servicing and Management tool Version: 6.2.9200.16384 Image Version: 6.2.9200.16384 Error: 87 The limitacces option is not recognized in this context. befo
-
Inserting a record in an internal table - Urgent
Hi Friends, I have a requirement where in I have 2 internal tables say itab1 and itab2.Itab1 has 10 records and itab2 has one record initially. Now I have to move the records of itab1 into itab2. My question is if some conditions satisfy,then I need
-
Having some trouble here and not sure if it's just the program showing where things will be placed, or if it'll be a print problem. Everytime i make a pattern in Illustrator using the Pattern tool, if it's large enough it'll show these faint little r
-
Hi How can I change the text value in the end of report that belong to pagination the text is "Next" OR "Previous", i want to change it