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

Similar Messages

  • 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.

  • Using lock object

    HI ,
    I have tables which are updated from FM .
    the table have user context .
    my question is if i need to use lock object if i dont create maintenance view for the tables ?
    Or in other words when to use it and when not ?
    Regards
    JOy
    Edited by: Joy Stpr on Oct 18, 2009 8:29 AM

    Hi Joy,
    Well to be specific I had used Locking the object in HR module, so i would like to explain based on that.
    HR modules have many views in a transaction...and they display data from tables.
    now when we change data...at times it is necessary that the data must not be changed at all.
    in such scenarios, we lock the object, means no changes can be done.
    as 1 friend has rightly mentioned abt enqueue function.
    actually theres a function module for enqueue...when u need to make any changes to the data...
    u shud 1st enqueue that particular record, so that no one else can edit it, or work on it....after making necessary changes, u then dequeue it...so that it becomes accessible for editing.
    so, basically locks, as name suggest can be used to prevent editing.
    either temporarily till u r making changes to it....or for a long time...
    but the locks can also be removed by coding...
    Hope this information helps u
    Regards,
    Radhika

  • How can i use lock objects

    hi  !  can anybody help me for above text? actually i am the new person for this module.

    <removed_by_moderator>
    Edited by: Julius Bussche on Aug 21, 2008 2:53 PM

  • Need a coding like report events step by step

    need a  coding how to write report events.
    step by step. by the material iam not getting any thing..
    please send me if you have coding or any examples..

    Hi Franklin,
    Please see the following link. You will find complete guide to report events.
    http://help.sap.com/saphelp_erp2005/helpdata/en/9f/db9a9635c111d1829f0000e829fbfe/frameset.htm
    Hope this helps,
    Pragya

  • Differeence between Lock object and enqueue_e_table

    Hi  ,
    what is diff between Lock object and enque_e_table.  Where to use enqueue_e_table and where to use lock object.
    I think with a lock object i can lock more than one table (passing tables  in secondary table). Please correct me.

    A lock object does not really "lock a table" though most of lock objects refer to a database table.
    I explain:
    The principle is that when 2 programs lock at the same time with the same lock object, only the first will succeed.
    If you have a program which does not use the lock, it may update the database table without any problem.
    All programs which update a table have to use the same lock object. Note that users are always able to update this table via SM30 as they don't know the lock object to be used.
    enqueue_xxxx is the name of the generated function module used to lock the xxxx lock object. E_TABLE lock is ONLY used by SM30 if I remember well, so that to prevent one table from being updated via SM30 by 2 persons at the same time. But it is not related at all with programs which would also update this table.
    Edited by: Sandra Rossi on Mar 14, 2010 9:53 PM

  • Regd using of lock object in an abap program

    Hi all,
         i have created an lock object but doesnot know how to use that lock object in an abap program. can anyone guide me how to use lock object in an abap program.

    check this sample for Production Order.
    <b>* Lock request for order
    call function 'ENQUEUE_ESORDER'
    exporting
       aufnr                = p_aufnr
    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.</b>
    Regards
    Prabhu

  • About lock object in Dynpro ABAP

    Hi Expert,
      We develop the Dynpro ABAP program to modify SAP document on EP,
    ( like Sales Order, Purchase order...ect. ).
    In tranditional  ABAP program, we use lock object(lock entry) to lock sigle document( SO, PO.. etc. )
    In Dynpro ABAP , how to lock the single document ?

    You can also use the "ENQUEUE" and "DEQUEUE" function modules to lock records in WDA as well.
    Check out the thread  [The effect of Session Expiration on Lock Table   |The effect of Session Expiration on Lock Table].
    Hope it helps.

  • 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>

  • How to find out where sap error messages stored in our system

    How to find out where sap error messages stored in our system.like sometime we will get a error message with message number.whr it will be stored and whch table it is?

    Are you interested in WDA messages ?
    The set a breakpoint in METHODS IN class CL_WDR_MESSAGE_MANAGER.
    Then use call stack (default desktop 2 in debugger) to see where message is added to message manager.
    regards
    phil

  • Lock Objects Problem while updating entries in custom table

    Hi Friends,
    Iam updating a custom table ztable from internal table entries.
    ie : Modify ZTABLE from table ITAB.
    Now the entries are updating and inserting perfectly..
    But my problem is i need to use lock objects before doing this..
    I have created a lock obect EZTABLE with all th ekey fields of the table.. ie : it has 2 key fields
    item & matnr .
    Now how to use lock objects here.. do i need to loop the internal table and use enque & deque function module each and every time in loop or use it out side the loop..
    Can any one explain me this..
    Regards,
    Kumar

    hi kumar,
    **check if the equipment is already locked by user, if yes, trigger a mail
                CALL FUNCTION 'ENQUEUE_EIEQUI'
                 EXPORTING
                MODE_EQUI            = 'E'
                MANDT                = SY-MANDT
                   equnr                = lv_equi_temp
                X_EQUNR              = ' '
                _SCOPE               = '2'
                _WAIT                = ' '
                _COLLECT             = ' '
                 EXCEPTIONS
                   foreign_lock         = 1
                   system_failure       = 2
                   OTHERS               = 3.
                IF sy-subrc <> 0.
                  lv_subrc1 =  sy-subrc.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
                ELSE.
                  CALL FUNCTION 'DEQUEUE_EIEQUI'
                   EXPORTING
                MODE_EQUI       = 'E'
                MANDT           = SY-MANDT
                     equnr           =  lv_equi_temp
                X_EQUNR         = ' '
                _SCOPE          = '3'
                _SYNCHRON       = ' '
                _COLLECT        = ' '
                ENDIF.
    try like this to check if the object is locked....
    u can also use
    call function 'ENQUEUE,.
    do the needful changes update the database then commit work
    then call function 'DEQUEUE'
    hope this helps,
    tanmaya

  • AJAX retrieval using Javascript Object Notation (JSON) - How To

    I have written up a how-to on my blog, explaining the steps involved to implement AJAX functionality using JSON for data transmission. It uses a simple example where the user makes a selection from a select list and 2 values are returned from the database into page items. I found it pretty simple to implement.
    http://anthonyrayner.blogspot.com/2007/06/ajax-retrieval-using-javascript-object.html
    Hope you like it, feedback welcome!!
    Anthony.

    Duplicate post.
    Yann C.
    France

  • Re-using planning objects

    Hi SDN friends,
    I have an existing implementation configured.
    Now, there is a need to customise the loading for new companies.
    So, this means existing solution implemented already must not be changed.
    I think I will base on existing solution.
    Is it possible to create another set of bps customizing based on the existing solution and using the same planning objects? But existing customizing must not be changed or touched.
    for example, can i create another planning area using the same planning objects under existing planning area?
    Please advise me, thanks.
    Regards
    Sanjay

    Dear,
    if you want to create new one then solution given by Vlad Stulikov  is good.
    If you want to used existing objects only and only for reporting purpose, somewhere else, you can go for multiplanning are.
    hope this will help you.
    Regards
    Vinay

  • Where do I use These lock object FM's (Enqueue & D? and How do I use them?

    I created lock object for user defined table (zconsist). The system automatically created 2 FM's (Enquiue & Dequeue).
    I created a new TCode and accessing this with mulitple users to do some updates and inserts in that above table.
    I used INSERT ZCONSIST statement in 5 places in my program (4 include programs).
    Where do I use These FM's? and How do I use them?
    I mean before inserting which FM I need to use? after immediately what fm used?.
    every insert statemnt before i need to use the respective fm? so 5 places i need to call the respective FM is it right?
    thank in advance.

    Hi Sekhar,
    Lock objects are use in SAP to avoid the inconsistancy at the time of data is being insert/change into database.
    SAP Provide three type of Lock objects.
    Read Lock(Shared Locked)
    protects read access to an object. The read lock allows other transactions read access but not write access to
    the locked area of the table
    Write Lock(exclusive lock)
    protects write access to an object. The write lock allows other transactions neither read nor write access to
    the locked area of the table.
    Enhanced write lock (exclusive lock without cumulating)
    works like a write lock except that the enhanced write lock also protects from further accesses from the
    same transaction.
    You can create a lock on a object of SAP thorugh transaction SE11 and enter any meaningful name start with EZ Example EZTEST_LOCK.
    Use: you can see in almost all transaction when you are open an object in Change mode SAP could not allow to any other user to open the same object in change mode.
    Example: in HR when we are enter a personal number in master data maintainance screen SAP can't allow to any other user to use same personal number for changes.
    Technicaly:
    When you create a lock object System automatically creat two function module.
    1. ENQUEUE_<Lockobject name>. to insert the object in a queue.
    2. DEQUEUE_<Lockobject name>. To remove the object is being queued through above FM.
    You have to use these function module in your program.
    check this link for example.
    http://help.sap.com/saphelp_nw04s/helpdata/en/cf/21eea5446011d189700000e8322d00/content.htm
    tables:vbak.
    call function 'ENQUEUE_EZLOCK3'
    exporting
    mode_vbak = 'E'
    mandt = sy-mandt
    vbeln = vbak-vbeln
    X_VBELN = ' '
    _SCOPE = '2'
    _WAIT = ' '
    _COLLECT = ' '
    EXCEPTIONS
    FOREIGN_LOCK = 1
    SYSTEM_FAILURE = 2
    OTHERS = 3
    if sy-subrc 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    endif.
    Normally ABAPers will create the Lock objects, because we know when to lock and how to lock and where to lock the Object then after completing our updations we unlock the Objects in the Tables
    http://help.sap.com/saphelp_nw04s/helpdata/en/cf/21eea5446011d189700000e8322d00/content.htm
    purpose: If multiple user try to access a database object, inconsistency may occer. To avoid that inconsistency and to let multiple user give the accessibility of the database objects the locking mechanism is used.
    Steps: first we create a loc object in se11 . Suppose for a table mara. It will create two functional module.:
    1. enque_lockobject
    1. deque_lockobject
    before updating any table first we lock the table by calling enque_lockobject fm and then after updating we release the lock by deque_lockobject.
    http://help.sap.com/saphelp_nw04/helpdata/en/cf/21eea5446011d189700000e8322d00/content.htm
    GO TO SE11
    Select the radio button "Lock object"..
    Give the name starts with EZ or EY..
    Example: EYTEST
    Press Create button..
    Give the short description..
    Example: Lock object for table ZTABLE..
    In the tables tab..Give the table name..
    Example: ZTABLE
    Save and generate..
    Your lock object is now created..You can see the LOCK MODULES..
    In the menu ..GOTO -> LOCK MODULES..There you can see the ENQUEUE and DEQUEUE function
    Lock objects:
    http://www.sap-img.com/abap/type-and-uses-of-lock-objects-in-sap.htm
    http://help.sap.com/saphelp_nw04s/helpdata/en/cf/21eea5446011d189700000e8322d00/content.htm
    Match Code Objects:
    http://help.sap.com/saphelp_nw2004s/helpdata/en/41/f6b237fec48c67e10000009b38f8cf/content.htm
    http://searchsap.techtarget.com/tip/0,289483,sid21_gci553386,00.html
    See this link:
    http://www.sap-img.com/abap/type-and-uses-of-lock-objects-in-sap.htm
    Check these links -
    lock objects
    Lock Objects
    Lock Objects
    kindly reward if found helpful.
    cheers,
    Hema.

  • Lock object using RFC

    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 Boscolo

    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.
    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

Maybe you are looking for