ENQUEUE, DEQUEUE of objects

Hi all,
i want to lock sales orders with fm ENQUEUE_EVVBAKE and
DEQUEUE_EVVBAKE.
This two fms work fine if i am in the same mode.
I start the fm ENQUEUE_EVVBAKE from one mode and want to unlock the entries from another mode.
The fm DEQUEUE_EVVBAKE runs with no errors. But the lock entry in the SM12 still exists.
Any ideas?
regards

Hi
See this and do accordingly
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

Similar Messages

  • Enqueue/Dequeue - Locking/Unlocking object

    Hi all,
    Please help me working with this enqueue/dequeue command. What I'm trying to do is to lock a Service Order. My requirement is to do a BDC for the Service Order Settlement Rule. So after hitting SAVE, a secondary process will be kicked off to perform my BDC for the same order. Now what Im doubting is that what if user re-enter the same Service Order again so quick. So my BDC program will not be performed immediately since it will be locked by the usser.
    So my idea is to lock it first while my BDC program is still running. Any help please? Thanks.

    Nope. Just 1 BDC -on my 2nd program only. Or to make it simple, I have modified ZXWOCU07 (IWO10009) to perform/kick off a call function( this is being triggered after hitting on SAVE). And this FM contains my checking if SO is now open for change then do the do the BDC.
    What I'm thinking is to lock first the SO  to block any user from accessing that SO, so it will do the BDC first. But I'm not yet familiar with the locking/unlocking of objects. Please help me on how to use enqueue or locking object.

  • Query on sap locks(ENQUEUE/DEQUEUE)

    Hi All,
    should the sap locks ENQUEUE/DEQUEUE need to be used  for all the updation/insertion  of records ino the table?
    Please confirm.Should this locking technique be used even for insertion of records into the table?
    Regards,
    Pra.

    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.
    Hope this will give a basic idea.

  • Issue with Enqueue / Dequeue

    We are working on a scenario where data is got into SAP through Web methods to create Sales orders.
    If we were to use Enqueue / Dequeue function while doing this would the web methods connection hold till the process is complete or would this time out in the middle?
    Is there any time out period for the connection with web methods, and if so how can it can be reset to an alternate value

    Hi,
    in ITS if you click on object, you can see the parmaters like
    ~TRANSACTION
    <b>~TIMEOUT</b>
    give more time for Time out parameter, that should solve the problem.
    Regards
    Vijay D T T.

  • 2515 Locking FMs to Enqueue/Dequeue/ Which one to use?

    I know this question is redundant, and has been responded to a million times....all differently. However, being their are 2,515 function modules to choose from, what are the best choices for locking and unlocking a custom database table?
    And, why are their 2,515 of them?
    I take that back....many many more!
        Thank-You
    Edited by: Tom Matys on Sep 23, 2011 12:15 PM

    Hi
    I think the best way is to create a new lock object for every custom tables.
    Every table should have an own lock object (so own fms to Enqueue/Dequeue) because it makes sure the same lock object is not used for another table at the same time.
    If the same lock object is used for many tables it can risk to find a certain record locked although nobody locks it really.
    Max

  • Material Enqueue & Dequeue

    I hav designed a new application for store i wish to enqueue & dequeue  materials which store persons are using.
    So how can this be done.Please guide once i open any material in my applcation its locked untill i come out my application.I wishto unclock as my processing is over.
    Pls guide whch FM to use.

    hi,
    Create a lock object from SE11 by giving the name
    lock object : ezlock_material.
    call the function module enqueu_ezlock  in  th loop to which to all the materials to lock.
    to lock the material
    call the function module dequeu_ezlock  in  th unloop to which to all the materials to unlock.
    to unlock the material.
    Regards,
    Madhavi

  • What is AQ Enqueue/Dequeue

    Hi ,
    Can anybody explain me the concept of AQ Enqueue/Dequeue
    I google and read the document but no get clear picture
    Thanks in Advance

    Check this link.
    http://www.oracle-developer.net/display.php?id=319
    >
    I google and read the document but no get clear picture
    >
    Which document you read and what is not clear ? Try to be more precise and to the point in your questions. It will help you a lot in a getting quick and meaningful answers.
    thanks
    Raj

  • Finding Enqueue/Dequeue functions

    Hi,
    Is there an easy way to find the enqueue/dequeue lock functions for a specific table?
    I tried to find the enqueue/dequeue functions for table LIKP. It took me a while to find it, but it turns out the name is ENQUEUE_EVVBLKE.
    You'd think that the table name would be incorporated into the function name to make it easy to find?!
    Does anyone have a suggestion?
    Thx.
    Andy

    Yes bro most of the times the table or field names would be in the Function module name.
    Raghav

  • JMS Enqueue/Dequeue without using oracle.jms package

    Hi,
    Is it possible to successfully enqueue/dequeue messages from Oracle AQ using JMS which only uses the classes under javax.jms package, not the classes under oracle.jms package. If possible, can anybody please provide some step by step example.
    Thanks

    You can get the connection factory and the queue from an application server's jndi. Create a resource provider reference in oc4j and get them from there. Read the oc4j services guide, oems (jms) chapter for how to do that.
    I think if you are not using an application server you can also get the connection factory and queue from an ldap directory. check out Aq user guide for that.

  • Enqueue/Dequeue in Oracle Aq Adapter

    Hi,
    I need to use enqueue/dequeue option in oracle aq adapter.
    However i need to know how the macthing of ids has to happen.
    Can any one provide me with an example with details steps?
    Thanks,
    Rosh

    The below url will provide information about AQ adapter,
    http://docs.oracle.com/cd/E21764_01/integration.1111/e10231/adptr_aq.htm
    Example of AQ adapter.
    http://jamessmith73.wordpress.com/oracle-fusion-middleware/oracle-soa-bpm-11g-blogs/soa-10g/soa-hands-on-4/
    Thanks,
    Vijay

  • Lock specific number of records using ENQUEUE & DEQUEUE

    Hi,
    Is it possible to lock a group of records in R/3?
    My requirement is to update a set of records in VBAP table. I'm not using a BAPI here. Instead, I use a direct UPDATE.
    In this case, i know i can lock individual records by passing VBELN and POSNR. But what if i have to lock 10 records?
    Is this possible in any way?
    Thanks in advance.
    The current solution is:
    1) LOOP at ITAB
    2) LOCK each entry
    3) UPDATE VBAP for that entry
    4) UNLOCK the entry
    5) Endloop
    I thought this solution might work: (Assume 10 records are present in ITAB)
    1) LOOP at ITAB (Lock all 10 entries)
    2) LOCK that entry
    3) ENDLOOP
    4) UPDATE VBAP from ITAB (Updates all 10 entries in one databae access)
    5) LOOP at ITAB(Unlock all 10 entries)
    6) UNLOCK that entry
    7) ENDLOOP
    Any help will be appreciated.
    Tabraiz.

    Hello,
    Both of your solutions will work.
    With solution 1 there will always be only 1 enqueue object created, because you always enqueue, perform the update and dequeue.
    This means that in SM12 you will only see 1 enqueue entry on your user ID at the same time when your program runs.
    Solution 2 is also possible but there you will have different enqueue objects that will be created, because you enqueue everything, then perform the updates and then dequeue everything.
    In SM12 (lock entries) this will result in more enqueue records on your user ID the time your program runs.
    You have to pay attention that lock entries (SM12) are stored in a queue that is limited, so make sure with solution 2 that you don't overflow the enqueue queue ! ! !
    Via tcode RZ11 you can check parameter enque/table_size (Size of lock table).
    Check the parameter value but also its documentation and you will understand why you should limit the number of open lock records.
    Success.
    Wim Van den Wyngaert

  • Enqueue/Dequeue

    Hi,
    There are 2 reports accessing 1 table. I am facing the runtime error with description - "The database system detected a deadlock and avoided it by rolling back your transaction.u201D
    Have come across implementing the ENQUEUE and DEQUEUE concept on the table. Please clarify the below queries:
    1.Is the above error occuring beacuse the two reports are accessing the table at the same time?
    2.Implementing EN/DEQUEUE will solve the problem?
    3.If first report is writing the data to table at 12pm(after locking the table), and the second report trying to access the table at 12:10pm to write the data, will this wait in some queue and write the data after the first report releases the table lock?
    Regards,
    Rajkamal

    Hello Raj,
    You should understand the difference between Database Locks & SAP locks.
    The database system detected a deadlock and avoided it by rolling back your transaction
    1.Is the above error occuring beacuse the two reports are accessing the table at the same time?
    Initial look at the statement suggests that this is because of Database Lock collision. You need to check if both the programs were trying to write (INSERT/UPDATE/MODIFY/DELETE) the same data to the DB table.
    2. Implementing EN/DEQUEUE will solve the problem?
    It should. But make sure you don't lock the entire table, try to lock only the individual records which are being processed(This is a good coding practice, of course you can override it depending on your requirement).
    3.If first report is writing the data to table at 12pm(after locking the table), and the second report trying to access the table at 12:10pm to write the data, will this wait in some queue and write the data after the first report releases the table lock?
    No, afiak there is no such queue. Alternatively you can put the lock in a iteration(viz., DO loop, WHILE loop) & check when the locks are released.
    Hope i'm clear.
    BR,
    Suhas

  • Enqueue/ Dequeue Table record

    Dear Experts,
    I am updating a record in my z-table which is appended in LFA1 through a Z-program.
    Prior to my update command i want to Enqueue that particular record and once it is updated i want to dequeue it.
    Can you please suggest the function module to perform this.
    Best Regards
    Ankur Gupta

    Hi
    You this FMs.
    ENQUEUE_E_TABLE
    DEQUEUE_E_TABLE
    The type of locks used in these are explained in the link below.
    http://help.sap.com/saphelp_nw04/helpdata/en/7b/f9813712f7434be10000009b38f8cf/content.htm

  • How to use Enqueue/Dequeue to prevent concurrent write?

    Hi All,
    I have a report program that allows multiple users to save to the database tables.
    How do I incorporate ENQUEUE and DEQUEUE statements to prevent concurrent write to ensure data integrity? Are there sample codes that I could refer to?
    Thanks

    Hi,
    here screen get locked
    CALL FUNCTION 'ENQUEUE_EIQMEL'
                   EXPORTING
                        mandt            = sy-mandt
                        qmnum          = i_final_ap-qmnum  -Notification number
                   EXCEPTIONS
                        foreign_lock     = 1
                        system_failure = 2
                        OTHERS         = 3.
    *--Setting the  task "PE03" for notification  on screen
              CALL FUNCTION 'IQS4_ADD_DATA_NOTIFICATION'
                   EXPORTING
                        i_qmnum    = i_final_ap-qmnum
                        i_conv     = ' '
                        i_post     = c_x
                        i_commit   = c_x
                        i_wait     = c_x
                   TABLES
                        i_viqmsm_t = i_viqmsm_tmp
                        return     = i_return.
      CALL FUNCTION 'DEQUEUE_EIQMEL'
                   EXPORTING
                        mandt = sy-mandt
                        qmnum = i_final_ap-qmnum.

  • Finding enqueue dequeue rate

    Hi,
    How to find enqueue and dequeue rate in Oracle Advanced Queue?
    Please post if there is any SQL query to find enqueue per second, dequeue per second.
    Regards,
    Guru

    Hello,
    Can you please show me how to run AWR report so that it generates AQ stats you talked about ?The AWR report will be started using the sql script "awrrpt.sql" ($ORACLE_HOME/rdbms/admin/awrrpt.sql).
    You will find all details in the original Oracle documentation, keyword AWR.
    In the generated report you will find two sections concerning AQ (including a list of all your defined AQs):
    ==> Persistent Queues
    Ordered by Queue Name
    indicates queue (re)started between Begin/End snaps
    %Exp Msgs - % of msgs enqueued with expiry
    %Delay Msgs - % of msgs enqueued with delay
    %Trasf Time - % of Enqueue time spent in transformation
    %Eval Time - % of Enqueue time spent in rule evaluation
    ==> Persistent Queues Rate
    Ordered by Queue Name
    indicates queue (re)started between Begin/End snaps
    Greetings
    WoG

Maybe you are looking for