LOCK OBJECT EXAMPLE
Dear All ,
I would like to know how to use the lock objects in module pool programming . I know that it has to be used when you are updatinng the data . But confused about how to implement . Please help me .
You simply call the assocaited function module ENQUEUE_<lock object name> and pass the key values of the table, then update your table, and call the associated DEQUEUE_<lock object name> function module to release the lock.
Regards,
Rich Heilman
Similar Messages
-
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> -
Hi gurus what is lock objects in datadictionary ,can explain with example
hi gurus what is lock objects in datadictionary ,can explain with exple
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.
Hope this will give a basic idea.
Here is a Link with good example
Lock Objects
Look the following Links for additionl info.
http://help.sap.com/saphelp_nw04/helpdata/en/c2/2d7037ecc92a7ee10000009b38f8cf/content.htm
http://help.sap.com/saphelp_nw70/helpdata/en/cf/21eea5446011d189700000e8322d00/content.htm
http://articles.techrepublic.com.com/5100-6329_11-5066352.html
Hope this Helps -
Hi Experts
Is there any standard lock objects exist, if so, pls guide me how
it works and locks the database with standard example for better understanding.
Thanks in advance.
Regards
RajaramLock objects are used if you want to Lock the table at ROW Level.
Every lock object will generate two Function MOdules. One for ENQUEUE and one for DEQUEUE.
http://www.sap-img.com/abap/type-and-uses-of-lock-objects-in-sap.htm
For the example check the link
http://help.sap.com/saphelp_nw04/helpdata/en/af/22ab01dd0b11d1952000a0c929b3c3/content.htm
Reward if useful
Regards,
Abhishek
Message was edited by:
Abhishek Jolly -
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. -
Hi,
in standard transaction I lock an object in an other system using RFC lock(enqueue function) but when I exit from transaction the object in other system is automatically unlocked without using the dequeue function.
Is It the correct behaviour?
Thanks,
Max BoscoloHi
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
Regards
Anji -
Hi experts,
My requirement is to create lock for parent table and its child tables.Each and every child tables is having relation with the parent table.
When iam creating the lock for parent table, in this process iam adding the child tables in the list.But here one child table is missing in the log eventhough its having the relation with parent table.
Valuable replies will be awarded with points.........
Regards,
Swetha.Hi,
it may help u
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
Regards -
Lock objects to allow 1 user to insert data at a time
Is it possible to Use lock objects to allow only 1 user to insert data into a database table at a time.
I am creating Assets using "BAPI_FIXEDASSET_CREATE1".
To create "n" assets similar to the asset I use a DO loop in my program and call the BAPI. (Please refer number of fixed assets field in AS01).
I need to avoid other users from manually creating assets using AS01 while the BAPI is running so that the range of assets created is consistent ( without gaps )
Thanks and Regards,
Ashwin<b>Lock objects</b> 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.
regards,
srinivas
<b>*reward for useful answers*</b> -
Hi,
Is it possible to create lock objects at runtime? if not, how do I lock tables at runtime when the table name is specified in the selection screen by the user?
Thanks.
TykenHi tyken,
Try this.
Lock Objects are Created using Tcode SE11.
The Lock object name must be start with EZur name.
Mainly lock objects are used for locking the transactions, tables --etec.
Multiple users can not updated the same transaction at the same time.
Whenever u create a lock object using se11. SAP internally
creates a two function modules:
Enqueue_lockobjname ---For Locking purpose,
dequeue_lockobjname---For Unlocking purpose.
U make use of these fms to lock and unlock transctions, tables..etc.
Steps to create lock objects :
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
The example is as follws:
EPORT ZLOCK_UNLOCK
MESSAGE-ID ZBDC.
TABLES ZSTUD.
DATA text(8) TYPE c.
CALL SCREEN 100.
*& Module USER_COMMAND_0100 INPUT
text
MODULE USER_COMMAND_0100 INPUT.
CASE SY-UCOMM.
WHEN 'SELECT'.
SELECT SINGLE * FROM ZSTUD WHERE ROLLNO = ZSTUD-ROLLNO.
MESSAGE i004 WITH 'SY-SUBRC:' sy-subrc.
WHEN 'EXIT'.
LEAVE PROGRAM.
WHEN 'ENQUEUE'.
CALL FUNCTION 'ENQUEUE_EZLOCK1'
EXPORTING
MODE_ZSTUD = 'X'
ROLLNO = ZSTUD-ROLLNO
EXCEPTIONS
FOREIGN_LOCK = 1
SYSTEM_FAILURE = 2
OTHERS = 3.
CASE sy-subrc.
WHEN 0.
MESSAGE i004 WITH 'Enqueue successful'(001).
WHEN 1.
text = sy-msgv1.
MESSAGE e004 WITH 'Record already'(002) 'locked by'(003)
text.
CALL TRANSACTION 'SM12'.
WHEN 2 OR 3.
MESSAGE e004 WITH 'Error in enqueue!'(004)
'SY-SUBRC:' sy-subrc.
ENDCASE.
WHEN 'DEQUEUE'.
CALL FUNCTION 'DEQUEUE_EZLOCK1'
EXPORTING
MODE_ZSTUD = 'X'
ROLLNO = ZSTUD-ROLLNO
EXCEPTIONS
OTHERS = 1.
CASE sy-subrc.
WHEN 0.
MESSAGE i004 WITH 'Dequeue successful'(005).
WHEN 1.
MESSAGE e004 WITH 'Error in dequeue!'(006).
ENDCASE.
WHEN 'SM12'.
CALL TRANSACTION 'SM12'.
ENDCASE.
ENDMODULE. " USER_COMMAND_0100 INPUT
*& Module STATUS_0100 OUTPUT
text
MODULE STATUS_0100 OUTPUT.
SET PF-STATUS 'BASIC'.
ENDMODULE. " STATUS_0100 OUTPUT
Regards,
Chitra -
How to use lock object? what we lock either total ztable or only record?
Hi
How to use lock object? what we lock either total ztable or only particular record?
Don't tell create lock object on se11 with E letter & acll it in program with eENQUEUE & DEQUEUE.
just tell me we will lock only particular record or total ztable?
specify with example.
Thanks.Hi
Go to SE11, in the option 'Lock object' enter the name of your lock,
begin with 'E', suppose 'EXXXX' And create. In tab 'Tables' fill the
table name where the record you want to lock exist and select the
lock mode. Lock mode can be shared and exclusive. If 'shared',
when you lock the record, other can also read data, but can not
modify. If 'exclusive', when you lock the record, other can neither
read nor modify the record. After save and activate, you will get two
function module.'ENQUEUE_EXXXX' to lock record,
'DEQUEUE_EXXXX' to release lock on one record.
When use this function module it only lock one record at a time. It
does not lock the table. -
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 -
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 -
How to create a Lock object ?
Hi ,
Iam very new to new to lockobjects . Can any one guide me to create lockobjects , naming standrs etc?Hi,
Do the following steps..
GO TO SE11
Select the radio button "Lock object"..
Give the name starts with EZ or EY..
<b>Example: EYTEST</b>
Press Create button..
Give the short description..
<b>Example: Lock object for table ZTABLE..</b>
In the tables tab..Give the table name..
<b>Example: ZTABLE</b>
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 modules to lock and unlock the records..
Thanks,
Naren -
Is it possible to get locked objects in passed time?
Hi,
I would like to get locked objects in passed time. The oracle version is 9i.
For example,
Can I get a list locked objects five days ago? Because I would like to keep locked objects statistics?
Does these information stored?
regards,Hi,
your best shot is ASH (active session history). It contains information about active sessions, their wait events, wait times, blockers, objects accessed, SQL running etc. For recent events you may query V$ACTIVE_SESSION_HISTORY, if you are interested in older data then you can try
looking in DBA_HIST_ACTIVE_SESS_HISTORY.
There are many limitations when analyzing ASH data, such as:
1) limited retention time
2) periodic sampling (you won't be able to see anything that falls in between snapshots)
3) bias towards longer events
etc.
so you need to be careful when analyzing these data.
Best regards,
Nikolay -
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
Maybe you are looking for
-
ITunes songs don't play on my iPod
Today I was simply listening to my iPod and I went to a playlist in which all of the songs were ones that I had purchased and downloaded via iTunes. I pressed play, and my iPod simply skipped over all of these songs and would not let me listen to the
-
Validation - calling a stored function
Hi: I have a function stored in the database that returns a bouleon for validation. Using PL/SQL function returning bouleon for page level validation, what is the correct syntax to use in the expression to call the function: Thank you. Bruce
-
PerformancePoint Add-in for Excel on Windows 8 / Office 2013?
Does anyone know if this is/will be supported?
-
Oracle9i XMLType and namespace declaration
Hi Folks, I am using the new XMLType for storing XML data and when I want to insert a XML document that contains a namespace declaration using sys.XMLType.createXML('<lom xmlns="http://www.imsglobal.org/xsd/imsmd_rootv1p2p1"...>...</lom>') function,
-
hi friends.. i want to create one input field in my selection screen for password. i.e data is invisible to the user.. is it possible in selection screen i m not using screen painter, just i am using se38 editor.. thanks in advance