Lock Object Concept required

Hi Everybody,
I have a quary. I have created a custom table which will be used to store master data entered by multiple Users through a module pool program. The program has following functionalities stated below:
CREATE : Entry of new data.
CHANGE: Changing of existing record.
DELETE: Delete existing record
I need to implement lock system inside the module pool program while performing the above operations. In CHANGE and DELETE mode I have implemented record lock system. But in case of CREATE mode which lock mode should I use, ie should I use whole table lock or particular record lock? agerly waiting for reply.
Regards,
Pulokesh

please find below links will be helpfull.
http://help.sap.com/saphelp_nw70/helpdata/en/cf/21eea5446011d189700000e8322d00/content.htm
http://help.sap.com/saphelp_nw70/helpdata/en/af/22ab01dd0b11d1952000a0c929b3c3/content.htm
http://help.sap.com/saphelp_nw70/helpdata/en/cf/21eef3446011d189700000e8322d00/content.htm
http://help.sap.com/saphelp_nw70/helpdata/en/cf/21ef0d446011d189700000e8322d00/content.htm

Similar Messages

  • Regarding Lock objects concept

    Hi,
       I am interested in knowing what is the significance of Lock objects in SAP.
       Can we co-relate SAP lock objects with Oracle.
        Frnds, I dont need any material i hav enough but i want to know the cocept behind this.
    Thanking u all.
    regards,
    suraj

    Hi,
    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
    Check these links -
    lock objects
    Lock Objects
    Lock Objects
    Regards,
    Priyanka.

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

  • Implementing lock object

    I've a TCode to modify a report. That TCode picks a doc no. from a table & opens up an editable ALV based on that doc. no .That doc. no. is the only primary key.
    I want that if someone is already opened that report, & if someoen else is trying to open that report, it shouldn't open & should show that -"its locked by User  XXX". I've made a lock object for that table. Please advise what to do next. How to populate the User name who has locked the report.

    used ENQUEUE function  and DEQUEUE function
    Function Modules for Lock Requests
    Activating a lock object in the ABAP Dictionary automatically creates function modules for setting (ENQUEUE_<lock object name>) and releasing (DEQUEUE_<lock object name>) locks.
    The generated function modules are automatically assigned to function groups. You should not change these function modules and their assignment to function groups since the function modules are generated again each time the lock object is activated.
    Never transport the function groups, which contain the automatically generated function modules. The generated function modules of a lock object could reside in a different function group in the target system. Always transport the lock objects. When a lock object is activated in the target system, the function modules are generated again and correctly assigned to function groups.
    Parameters of the Function Modules
    Field Names of the Lock Object
    The keys to be locked must be passed here.
    A further parameter X_<field> that defines the lock behavior when the initial value is passed exists for every lock field <field>. If the initial value is assigned to <field> and X_<field>, then a generic lock is initialized with respect to <field>. If <field> is assigned the initial value and X_<field> is defined as X, the lock is set with exactly the initial value of <field>.
    Parameters for Passing Locks to the Update Program
    A lock is generally removed at the end of the transaction or when the corresponding DEQUEUE function module is called. However, this is not the case if the transaction has called update routines. In this case, a parameter must check that the lock has been removed.
    Parameter _SCOPE controls how the lock or lock release is passed to the update program (see The Owner Concept for Locks). You have the following options:
    &#65399;        _SCOPE = 1: Locks or lock releases are not passed to the update program. The lock is removed when the transaction is ended.
    &#65399;        _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.
    &#65399;        _SCOPE = 3: The lock or lock release is also passed to the update program. The lock must be removed in both the interactive program and in the update program. This is the standard setting for the DEQUEUE function module.
    Parameters for Lock Mode
    A parameter MODE_<TAB> exists for each base table TAB of the lock object. The lock mode for this base table can be set dynamically with this parameter. The values allowed for this parameter are S (read lock), E (write lock), X (extended write lock), and O (optimistic lock).
    The lock mode specified when the lock object for the table is created is the default value for this parameter. This default value can, however, be overridden as required when the function module is called.
    If a lock set with a lock mode is to be removed by calling the DEQUEUE function module, this call must have the same value for the parameter MODE_<TAB>.
    Controlling Lock Transmission
    Parameter _COLLECT controls whether the lock request or lock release should be performed directly or whether it should first be written to the local lock container. This parameter can have the following values:
    &#65399;        Initial Value: The lock request or lock release is sent directly to the lock server.
    &#65399;        X: The lock request or lock release is placed in the local lock container. The lock requests and lock releases collected in this lock container can then be sent to the lock server at a later time as a group by calling the function module FLUSH_ENQUEUE.
    Whenever you have lock mode X (extended write lock), locks should not be written to the local lock container if very many locks refer to the same lock table. In this case, there will be a considerable loss in performance in comparison with direct transmission of locks.
    Behavior for Lock Conflicts (ENQUEUE only)
    The ENQUEUE function module also has the parameter _WAIT. This parameter determines the lock behavior when there is a lock conflict.
    You have the following options:
    &#65399;        Initial Value: If a lock attempt fails because there is a competing lock, the exception FOREIGN_LOCK is triggered.
    &#65399;        X: If a lock attempt fails because there is a competing lock, the lock attempt is repeated after waiting for a certain time. The exception FOREIGN_LOCK is triggered only if a certain time limit has elapsed since the first lock attempt. The waiting time and the time limit are defined by profile parameters.
    Controlling Deletion of the Lock Entry (DEQUEUE only)
    The DEQUEUE function module also has the parameter _SYNCHRON.
    If X is passed, the DEQUEUE function waits until the entry has been removed from the lock table. Otherwise it is deleted asynchronously, that is, if the lock table of the system is read directly after the lock is removed, the entry in the lock table may still exist.
    Exceptions of the ENQUEUE Function Module
    &#65399;        FOREIGN_LOCK’: A competing lock already exists. You can find out the name of the user holding the lock by looking at system variable SY-MSGV1.
    &#65399;        SYSTEM_FAILURE: This exception is triggered when the lock server reports that a problem occurred while setting the lock. In this case, the lock could not be set.
    If the exceptions are not processed by the calling program itself, appropriate messages are issued for all exceptions.
    Reference Fields for RFC-Enabled Lock Objects
    The type of an RFC-enabled function module must be completely defined. The parameters of the generated function module therefore have the following reference fields for RFC-enabled lock objects:
    Parameters
    Reference fields
    X_<field name>
    DDENQ_LIKE-XPARFLAG
    _WAIT
    DDENQ_LIKE-WAITFLAG
    _SCOPE
    DDENQ_LIKE-SCOPE
    _SYNCHRON
    DDENQ_LIKE-SYNCHRON
    See also:
    Example for Lock Objects
    http://help.sap.com/saphelp_nw04/helpdata/en/cf/21eebf446011d189700000e8322d00/content.htm

  • Lock objects

    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

  • Can i use the SAP standard package for lock object creation ?

    Dear Guru ,
    I want to create a new lock ojbect for my abap program .
    When i completed the creation , SAP required a new request and it said the object only can be imported to SAP standard package .
    But i saw the help from SAP said :
    >* Package begins with A-S or U-X:
    >These packages are for SAP standard objects. Customer objects cannot be created in them. Changes to objects of these packages are recorded by the Transport Organizer (Request management) and can be transported (see field transport layer.
    In this case ,  Can i use one of the SAP standard package for this creation ? Does it will affect the SAP system ( such as the system upgrade ) ?
    Thanks .
    Best Regards,
    Carlos Zhang
    Moderator message - Please do not use code tags to format text - it should only be used for code
    Edited by: Rob Burbank on May 25, 2010 11:12 AM

    Hi Carlos...
    First , You will never be able to use any standard SAP Package for your custom programs. So don't go for it.
    So in your case what you need to do is , when you save your Lock object , 
    - if you want Transport request to be created , then 
    in the screen shown you need to enter the Z package name (the same package as that of your ABAP Program)
    or
    -if you want it to be stored as local object , then
    specify package as $tmp
    Regards,
    Uma

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

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

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

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

  • Lock Object  Confusion

    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 namdeo

    Hi
    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

  • Find lock object for field

    Hi Friends,
    I have one qurey. I would like to know the lock object for field MATNR.
    Any suggestion how I can find it out the lock object for specific field.
    Regards,
    Poonam

    hi,
    GOTO se11.
    select Lock object Radio button.
    Press F4.
    A popup appears, in that popup, under Short Description, type
    *Material* and press enter. you will get a list of lock objects, select your required.
    Always give the first letter in CAPS. like *Material*.

  • Lock object update in contract account

    Hi All,
    If anyone knows any BAPI which updates the lockobject in the outgoing payment of a contract account,please respond.
    My requirement is to update the TO date of lock object in the outgoing payment of a contract account.
    Is there any other possibility to do the same.
    Awaiting for response.
    Regards,
    Bharathi.J

    Hello,
    Sorry, we don't use a BAPI to update locks, but we do use the following function modules:
    FKK_O_LOCK_OPEN
    FKK_O_LOCK_METHOD_SET_LOCKDATA
    FKK_O_LOCK_METHOD_SAVE
    FKK_O_LOCK_CLOSE
    You can use BAPI_ISUACCOUNT_CHANGE to issue a new lock.
    K---
    Message was edited by:
            Kathryn McGallicher

  • Re: 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.kp

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

  • Locked Objects

    Hi,
    I want to ask is that if i can find any objects in the V$locked_Object then do i need to kill those sessions always????
    The thing is when i see some objects in the locked_objects i am looking for the query which is locking the object. But after some that that sesssion removed from V$locked_Object
    Sometimes if i track any locked object and find the query related to it that time query is normal query of SELECT.
    1. So do i need to worry about it to resolve lock? And always i need to kill that session which is in V$Locked_Object.
    2. Also please let me know how can i check which SQL statements in a day locking objects in the database Can we check this one?
    Please give any idea about.

    DBA_BLOCKERS lists the sessions that hold a lock that another session is blocked on a request for. DBA_WAITERS lists the sessions that are blocked requesting a lock that some other session holds. Are you seeing any rows in these tables? If we're talking about a bunch of sessions that are taking out row share locks, for example, there's nothing to be concerned about because those aren't (generally) going to block anyone else.
    If you are, are the blocks resolving themselves? A session that takes out a lock might block another session temporarily, but as long as the blocker finishes its processing and releases the lock within a reasonable time frame, the waiter should be able to continue after the lock is released. There may be options to redesign the application so that the blocker locks fewer objects/ fewer rows/ holds the lock for less time in order to decrease contention, but certainly nothing that would require DBA intervention.
    The case where a DBA needs to be involved is when
    - A session takes out a lock that is capable of blocking other sessions
    - For whatever reason, that session fails to release the lock
    - One (or more) other sessions are blocked waiting for the lock to be released
    The classic example of this would be an application that was poorly designed to do pessimistic locking and to hold locks across user interactions. So if an application does a SELECT FOR UPDATE to lock a particular row and holds that row while waiting for a human to do something, but the human decides to go to lunch/ work in a different application/ go on vacation, every other user that tries to lock that same row is going to block, which can be highly unpleasant.
    Justin

  • Reassigning the Locked object in ID

    Hi Expert,
    I amtrying to the edit the Communication channel object and it is throughing the error like " <object name> is already locked in another chnage list by user <user name> if necessary, you can reassign the other user's change list to yourself
    can any body give me an idea how can we reassign the object?
    THanks in Advance
    Neeru

    Hi Neeru,
    you have 2 options.
    1. Unlock the object
    2. Re-assign the object to another user.
    Unlock the object: in the XI home page click on Administration --> Lock over view then select the required locked object and click on unlock.
    Re Assign the object: Go to ESR change list and select the required object then give the target user name and click on transfer then that object is transferred to the required target user.
    Regards
    Ramesh

Maybe you are looking for

  • How do I get iCloud Drive in the Finder window?

    I have just installed Yosemite on my early 2009 iMac and want to use iCloud drive.  I have been using iCloud up till now and have an iPhone 5 running iOS 8 with iCloud drive enabled and an iPad 3 also running iOS8 with iCloud drive enabled. I have up

  • Is there a way to get support per mail?

    Hi there Im having some issues with my security questions for my itunes account. (Trying to buy a movie but since its the first time on my new Pc i need to answer them) That aside, im actually only looking for a way to get support PER MAIL and not by

  • Using Apple to store and play my DVDs

    I have hundreds of movies on DVD-- all legally purchased over the years. What is the best way to store them and play them? A mac mini? Apple TV? I would like to be able to use Front Row to browse my library on the big screen TV. Any recommendations f

  • Latest study material for ABAP certification exam code C_TAW12_04

    Hi All, Please provide latest study material for ABAP certification-C_TAW12_04 exam. They have changed the syllabus and exam pattern this year. Please provide the information about it.

  • Not working...imagenomic plug in & adobe cc :(

    I've tried to download imagenomic portraiture plug in but it's not showing up in photoshop.  Please help.