Query about SAP locks /enqueue objects

I have created an lock object for a bespoke table which has 5 key fields.  For arguments sake let's call them
WERKS QMGRP QMCOD OTGRP OTEIL.
The problem I have is the following:
User 1 has a house profile that can access the following data:
WERKS QMGRP QMCOD OTGRP OTEIL
9026  HOUSE CUST
User 2  has a functional profile which gives them access to the following:
WERKS QMGRP QMCOD OTGRP OTEIL
9026  HOUSE CUST 
9026  HOUSE CUST   CS    C001
9026  HOUSE CUST   CS    C002
I am building a front-end to the table to enable the users to change data associated with these keys.  My problem is the following.  If User 2 locks the entries,(s)he has access to first, the user 1 entry will be locked to changes,  which is correct.  If, however, user 1 locks its entry first, <b>all</b> of user 2's entries are locked even though only the first entry is allowed to be accessed by both.  I think this is happening because the SAP lock object does not recognise '   ' '    ' as a separate value to 'CS' 'C001'.  It thinks because 9026 HOUSE CUST '   ' '    ' is locked, then the other entries should be locked because they share 9026 HOUSE CUST from the key, even though there are other values in the key following 9026 HOUSE CUST.
What I want is if user 1 locks its entry first, then only the entry that matches the key  totally for user 2 is locked, leaving the other 2 entries to which user 2 has access free to be edited.
Is there a way I can get the SAP lock object to recognise this eitehr by changing the enqueue function module or by the way I cal the enqueue object or not?
Any help would be appreciated.
Hope this makes sense
Larissa

Hi Larissa,
As far as I know, You cannot change generated enqueue function module. The other way as i think might work would be to create a new FM and do manipulation (for space to be changed as some other value) before calling this generated Enqueue FM.
Hope this helps.
Regards,
Vicky
PS: Award points if helpful

Similar Messages

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

  • Urgent query about copying array of objects to html item

    I have an urgent query about how I can display an array of objects on a html form. The only suitable html item I can see for this is a drop down box. Ideally a combo box would be preferable but I cant find anything like this. Basically the display item needs to contain 3 columns of data and has to display a number of rows. Can anyone tell me how to copy the array of values into a drop down box?

    Here is all the code from my jsp. It keeps returning null:
    <%@ page language="java" %>
    <%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
    <%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
    <%@ page import="java.util.*, java.lang.*" %>
    <html:html locale="true">
    <head>
    <meta HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=windows-1252"/>
    <link rel="stylesheet" type="text/css" name="timesheet" href="stylesheets/timesheet.css"></link>
    <script type="text/javascript" language="javascript" src="javascript/sum.js"></script>
    <title><bean:message key="eng.title"/></title>
    <html:base/>
    </head>
    <body bgcolor="white">
    <table border="0" width="100%">
    <tr>
    <td width="30%"><html:img page="/images/PwC_logo.gif"/></td>
    <td width="40%" class="applicationTitleCell">
    <div align="center">
    <bean:message key="application.title"/>
    </div>
    </td>
    <td width="30%"> </td>
    </tr>
    </table>
    <center>
    <html:form action="/selectEng" focus="engSearchNumber">
    <table border="0" width="100%">
    <tr>
    <td width="30%"></td>
    <td width="20%" align="center"> <b> <bean:message key="eng.prompt.engSearchNumber"/> </b> </td>
    <td width="20%" align="center"> <b> <bean:message key="eng.prompt.clientSearchName"/> </b> </td>
    <td width="40%">   </td>
    </tr>
    <tr>
    <td width="30%"></td>
    <td width="20%" align="center"> <html:text property="engSearchNumber" size="20" maxlength="9" onchange='<%= "SearchLength(this)" %>' onkeypress="return NumberOnly()" /> </td>
    <td width="20%" align="center"> <html:text property="clientSearchName" size="20" maxlength="20" onchange='<%= "SearchLength(this)" %>'/> </td>
    <td width="30%">   </td>
    </tr>
    </table>
    <table border="0" width="100%">
    <tr>
    <td width="30%"></td>
    <td width="40%" align="center"><html:image property="findButton" src="images/Find.gif" alt="Find"/></td>
    <td width="30%">   </td>
    </tr>
    <jsp:useBean id="selectEngForm" scope="session" class="Time.SelectEngForm" />
    <% if (selectEngForm.getEngSearchNumber() != null) { %>
    <tr>
    <td width="30%"></td>
    <td width="40%" align="center"><select name="engListing" size="5">
    <%= selectEngForm.getEngListing() %>
    </select></td>
    <td width="30%">   </td>
    </tr>
    <% } else if (selectEngForm.getClientSearchName()!=null){ %>
    <tr>
    <td width="30%"></td>
    <td width="40%" align="center"><select name="engListing" size="5">
    <%= selectEngForm.getEngListing()%>
    </select></td>
    <td width="30%">   </td>
    </tr>
    <% } %>
    <%=request.getParameter("engListing")%>
    </table>
    <br><br>
    <table border="0" width="100%">
    <tr>
    <td width="30%"></td>
    <td width="11%" align="center"> <html:image property="addButton" src="images/Add.gif" alt="Add the selected engagement to the timesheet"/> </td>
    <td width="11%" align="center"> <html:image property="cancelButton" src="images/Cancel.gif" alt="Cancel"/> </td>
    <td width="30%">   </td>
    </tr>
    </table>
    </html:form>
    </center>
    <br>
    <center><html:link forward="timesheet"> <html:img src="images/Back.gif" border="0"/> </html:link></center>
    </body>
    </html:html>

  • Query About Sap Notes

    Hi,
    I want to know where can I get more indformation about SAP notes.
    e.g.  We have a sap note no. 'note 871787' , for a newly piece of code added to a standard function module.
    Where can i get motre information about this note .

    Hi
    To check the SAP Notes you need to have the OSS User Id to logon.
    Goto www.service.sap.com-> SAP Support Portal--> Enter your OSS User ID
    Search for required SAP Note. And open the Note.
    The SAP Note describes you the how to modify the program,.
    First check the Componet information from your SAP system.. Goto> system> status---> Component Information.
    Then for each Component (SAP_APPL -- 470, 500, 600....)there will be different modification.
    Now choose your Component and replace the code from SAP Note Correction instructions to your SAP Syatem.
    Thanks & Regards,
    Dileep .C

  • SAP Lock (Enqueue Lock)

    Hi there,
    I have used SAP Enqueue and Dequeue Lock in my program. However, it does not seems to work. Do I need to have a specific authorisation in order to be able to perform Enqueuing n Dequeuing?
    In addition, when i perform CALL FUNCTION 'ENQUEUE_XXXXXX', what does the return code, sy-subrc = 4 signifies?
    Thank You.

    Use transaction SM12 to see if you already have any locks.  Also worth checking the data you are trying to lock is actually on your database table.
    Gareth.

  • General query about SAP

    Hi,
    Would the installed Products & relevant Components be present in the Database? How can we query the Database to obtain this information? Which DB Privileges would we need? would those privileges database specific like for oracle and ms sql?
    Is there a way to obtain the same information that Easy Access shows, via Command Line? Is there a command that, given the relevant options, will query SAP, and return information in the stdout?
    Regards,
    MNA

    Would the installed Products & relevant Components be present in the Database?
    -Yes, always...
    How can we query the Database to obtain this information?
    -By select statements on the tables already specified
    Which DB Privileges would we need?
    -All depends on the platform and db type. Means, you need enough authentication and authorizations to access the tools specific to the database vendor to run the query you want. So, database administrator user, like orasid (oracle on SAP), db2sid (db2 on sap) etc...should be able to login into sqlplus(oracle), db2 prompt(DB2), query analyzer(MSSQL) tools.
    would those privileges database specific like for oracle and ms sql?
    -Yes, refer to specific database guides for details. However, database administrator user is created automatically in all databases and this is normally referred as same in all DBs. But, theoritically speaking, actuall naming conventions are very specific the database vendor.
    Is there a way to obtain the same information that Easy Access shows, via Command Line? Is there a command that, given the relevant options, will query SAP, and return information in the stdout?
    in DB2, you use db2 command line processor db2clp. in MSSQL, you use the query analyzer. In Oracle, you use SqlPlus. To save the output of the query, you can use the SPOOL command.

  • Query about Function based geometry object problem

    Hi, I got stuck with a query like this:
    SELECT count(*)
    FROM property_point WHERE
    get_geom(v_start,v_end,t_start,t_end).get_gtype() = 1 --point
    AND --get all the points within the rectangle (min,min,  now,now)
    SDO_RELATE(get_geom(v_start,v_end,t_start,t_end),
    mdsys.sdo_geometry(2003,NULL,NULL,
    mdsys.sdo_elem_info_array(1,1003,3),
    mdsys.sdo_ordinate_array(
    to_number(to_char(to_date('01-JAN-1992','DD-MON-YYYY'),'J')),
    to_number(to_char(to_date('01-JAN-1992','DD-MON-YYYY'),'J')),
    to_number(to_char(sysdate,'J')),
    to_number(to_char(sysdate,'J')))),
    'mask=INSIDE querytype=WINDOW') = 'TRUE'
    OR
    get_geom(v_start,v_end,t_start,t_end).get_gtype() = 2 --line
    AND --get all the lines interact with transaction now
    SDO_RELATE(get_geom(v_start,v_end,t_start,t_end),
    mdsys.sdo_geometry(2002,NULL,NULL,
    mdsys.sdo_elem_info_array(1,2,1),
    mdsys.sdo_ordinate_array(
    to_number(to_char(sysdate,'J')),
    to_number(to_char(to_date('01-JAN-1992','DD-MON-YYYY'),'J')),
    to_number(to_char(sysdate,'J')),
    to_number(to_char(to_date('31-DEC-2008','DD-MON-YYYY'),'J')))),
    'mask=ANYINTERACT querytype=WINDOW') = 'TRUE'
    AND --get all the lines interact with valid now
    SDO_RELATE(get_geom(v_start,v_end,t_start,t_end),
    mdsys.sdo_geometry(2002,NULL,NULL,
    mdsys.sdo_elem_info_array(1,2,1),
    mdsys.sdo_ordinate_array(
    to_number(to_char(to_date('01-JAN-1992','DD-MON-YYYY'),'J')),
    to_number(to_char(sysdate,'J')),
    to_number(to_char(to_date('31-DEC-2008','DD-MON-YYYY'),'J')),
    to_number(to_char(sysdate,'J')))),
    'mask=ANYINTERACT querytype=WINDOW') = 'TRUE'
    OR
    get_geom(v_start,v_end,t_start,t_end).get_gtype() = 3 --rectangle
    AND --interact with transaction now
    SDO_RELATE(get_geom(v_start,v_end,t_start,t_end),
    mdsys.sdo_geometry(2002,NULL,NULL,
    mdsys.sdo_elem_info_array(1,2,1),
    mdsys.sdo_ordinate_array(
    to_number(to_char(sysdate,'J')),
    to_number(to_char(to_date('01-JAN-1992','DD-MON-YYYY'),'J')),
    to_number(to_char(sysdate,'J')),
    to_number(to_char(to_date('31-DEC-2008','DD-MON-YYYY'),'J')))),
    'mask=ANYINTERACT querytype=WINDOW') = 'TRUE'
    AND --interact with valid now
    SDO_RELATE(get_geom(v_start,v_end,t_start,t_end),
    mdsys.sdo_geometry(2002,NULL,NULL,
    mdsys.sdo_elem_info_array(1,2,1),
    mdsys.sdo_ordinate_array(
    to_number(to_char(to_date('01-JAN-1992','DD-MON-YYYY'),'J')),
    to_number(to_char(sysdate,'J')),
    to_number(to_char(to_date('31-DEC-2008','DD-MON-YYYY'),'J')),
    to_number(to_char(sysdate,'J')))),
    'mask=ANYINTERACT querytype=WINDOW') = 'TRUE'
    which returns 0 rows.
    But if only use the first condition, say
    SELECT count(*)
    FROM property_point WHERE
    get_geom(v_start,v_end,t_start,t_end).get_gtype() = 1 --point
    AND --get all the points within the rectangle (min,min,  now,now)
    SDO_RELATE(get_geom(v_start,v_end,t_start,t_end),
    mdsys.sdo_geometry(2003,NULL,NULL,
    mdsys.sdo_elem_info_array(1,1003,3),
    mdsys.sdo_ordinate_array(
    to_number(to_char(to_date('01-JAN-1992','DD-MON-YYYY'),'J')),
    to_number(to_char(to_date('01-JAN-1992','DD-MON-YYYY'),'J')),
    to_number(to_char(sysdate,'J')),
    to_number(to_char(sysdate,'J')))),
    'mask=INSIDE querytype=WINDOW') = 'TRUE'
    will return 688 rows.
    besides, 2nd and 3rd condition will return 0 and 5 rows.
    Why it became 0 when putting them together?
    This is the structure of table property_point and function get_geom
    and I am using 10.1.0.3 version
    CREATE TABLE property_point (
              SALES_ID number,
              AGENT_ID number,
              SALES_PRICE number,
              LOCATION MDSYS.SDO_GEOMETRY,
              V_START date,
              V_END     date,
              T_START date,
              T_END     date);
    CREATE OR REPLACE FUNCTION get_geom(v_start in date, v_end in date, t_start in date, t_end in date)
    return MDSYS.SDO_GEOMETRY deterministic is
    I wonder if I missed anything here?

    I have not used this myself, but check if this works for you.
    RSPO_DOWNLOAD_SPOOLJOB
    Regards,
    Ravi
    Note : Please mark the helpful answers

  • Query about SAP ABAP programming?

    I am not good at programming but wanted to make a career in SAP. SAP counselor said that being a fresher it is extremely difficult to find a job in other modules and ABAP is the only option for me, but she said that programming is not that hard in ABAP, only have to remember ABAP dictionaries and rest is not that hard btwn one of my friend said that one cannot learn ABAP without having knowledge in C++ or .Net and there will be some OOPS concepts that need to be learnt before learning ABAP. Are the concepts not taught in ABAP. Plz state your opinion. I am not good programmer but a hard worker

    Hi Dude,
    Don't worry, no people born as genius.
    1. ABAP is a nice programming language and you can start learning ABAP by yourself too, but you need someone at very first stage.
    2. ABAP is also having OOPs concept, it is not that much hard to understand.
    3. If you knew any other programming language then it would be much easy to go with ABAP, means if you know one programming language then other programming language would be easy to learn, because concept wise all programming language same, only syntax would vary.
    So, all the best.
    Notes:- I have heard "Hard Work Never Fails"
    Regards!
    Sheik

  • Query about SAP Web AS 640

    Hi All,
    Can you please let me know the latest Service pack for SAP Web AS 640. If possible get me a documentation to follow.
    Regards
    Anirudh

    Hi Anirudh,
    The latest one is SPS17, according to this following link :
    http://help.sap.com/saphelp_nw04/helpdata/en/44/4742b29d780597e10000000a155369/frameset.htm
    Please check this out.
    Regards,
    Sudeep

  • FM to find user who locked the object using enqueue...

    Hello,
    How can I find name of user who enqueued the lock object in ABAP ?
    Regards,
    Jainam.

    Hi Jainam,
    See the SAP documentation, e.g. [FAQ - Lock concepts|http://help.sap.com/saphelp_NW04/helpdata/en/cb/168237d30d974be10000009b38f8cf/content.htm]:
    How can I find out who is currently holding the ungranted lock? In other words, how can check the program after an ENQUEUE to determine which use is currently holding the lock so that I can let him or her know?                                 
    This graphic is explained in the accompanying text Answer
    When the ENQUEUE_... function module is returned, the name of the lock owner is listed in SY-MSGV1.
    If you don't want to attempt to lock an object and just check who might own a lock use function module ENQUEUE_READ. Lots of comments in the forum...
    Cheers, harald

  • Query on SAP Business Object and Content shipment..

    I know about SAP Business Suite... & SAP Business One... But what is :
    1. SAP Business Object and
    2. Content Shipment
    The definitions on the SAP Release & Maintenance Strategy and other docs on SDN were not too clear for my understanding. I want to know why are they used / where are they applied ? E.g: if you have a SAP BW system.. why would you need SAP BW Content ? where does it fit in the picture and what purpose does it serve...
    (PS: it would be great if someone can share the product / functionality details of their landscape where these systems are used, how does it benefit the business operations and any other purpose of having them... )
    Thanks,

    Hi Ashim,
    If your client want it to be done in one database, then the answer is no if you do not have any add-on or SDK codes.  Most difficult part is authorization since I believe what you mean project here is not the same as project center in B1,
    If your client allow more than one database, then the configuration will be easy.
    Thanks,
    Gordon

  • Query about ABAP future in SAP HANA

    Hello Experts,
    I have read many articles and SDN post about SAP HANA but does not get clear answer.
    I am having 7 years of experience of SAP ABAP and wanted to learn ABAP in SAP HANA.
    I learn that SAP HANA is having its own language also as SQL script in earlier release but would this be using also in current and future.
    So would learning of SQL script give more advantage and how can i get started learning ABAP in SAP HANA.
    Thanks
    SHiv

    Dear Shivshanker,
    for ABAP for SAP HANA see http://scn.sap.com/docs/DOC-29357.
    In addition there are some nice blogs by Thomas Jung. You can use, for example,http://scn.sap.com/community/in-memory-business-data-management/blog/2012/04/11/test as entry.
    ABAP and SAP HANA | SAP HANA
    and also  Rapid Deployment of SAP Solutions in open.sap.com
    Best of luck...
    Regards,
    Abbas.

  • Locking of objects between service calls

    Hello,
    Is there any practial way to lock an object (for example a loan) with one service so that it stays locked until another service commits the transaction and releases the lock? The service is a RFC function module that will be called by a web application. My problem is that when I use the standard ENQUEUE function the lock dissappears as soon as the first service is finished.
    Also, if one service would create a lock of an object and another one starts the update task, they probably wouldn't be in the same LUW, would that be a problem? If so, is there a solution?
    Thank you and kind regards,
    Steffen

    Steffen:
    In the locking service use the _SCOPE parameter value of 3 in your enqueue function call. This retains the lock after the first service (locking process) ends. The second service that does the update can then dequeue the lock after the update is processed.
    No problem with setting & freeing locks in different LUW, as the SAP locking mechanism is co-operative (i.e. software controlled) rather than database controlled. Just make sure that you use a standard SAP enqueue function so that other unrelated processes will honor the lock set by your first service.
    Regards,
    D.

  • Intenal error in SAP lock management system

    Hi All,
    I got an error like this:
    "An internal error was found in SAP lock management system when attempting to lock an object by calling an ENQUEUE functional module".
    Can you provide me a solution as soon as possible..
    Thanks in advance,
    Sreepathi

    Hi Sreepathi,
    Usually this happen when the enque process is no longer accesible. I will schedule a system and db restart.
    Regards
    Juan
    Please reward with points if helpful

  • Re: what is difference between sap locking and database locking

    hi,
        what is difference between sap locking and database locking. Iam locked the table mara by using lock objects.
    But iam unable to unlock the mara table. I give u the coding. Please check it.
    REPORT zlock .
    CALL FUNCTION 'ENQUEUE_EZTEST3'
    EXPORTING
       MODE_MARA            = 'S'
       MANDT                = SY-MANDT
       MATNR                = 'SOU-1'.
    call transaction 'MM02'.
    CALL FUNCTION 'DEQUEUE_EZTEST3'
         EXPORTING
              mode_mara = 'E'
              mandt     = sy-mandt
              matnr     = 'SOU-1'.
    IF sy-subrc = 0.
      WRITE: 'IT IS unlocked'.
    ENDIF.

    Hi Paluri
    Here is the difference between SAP locks and Database locks, i will try to find the solution to your code.
    Regards
    Ashish
    Database Locks: The database system automatically sets database locks when it receives change statements (INSERT, UPDATE, MODIFY, DELETE) from a program. Database locks are physical locks on the database entries affected by these statements. You can only set a lock for an existing database entry, since the lock mechanism uses a lock flag in the entry. These flags are automatically deleted in each database commit. This means that database locks can never be set for longer than a single database LUW; in other words, a single dialog step in an R/3 application program.
    Physical locks in the database system are therefore insufficient for the requirements of an R/3 transaction. Locks in the R/3 System must remain set for the duration of a whole SAP LUW, that is, over several dialog steps. They must also be capable of being handled by different work processes and even different application servers. Consequently, each lock must apply on all servers in that R/3 System.
    SAP Locks:
    To complement the SAP LUW concept, in which bundled database changes are made in a single database LUW, the R/3 System also contains a lock mechanism, fully independent of database locks, that allows you to set a lock that spans several dialog steps. These locks are known as SAP locks.
    The SAP lock concept is based on lock objects. Lock objects allow you to set an SAP lock for an entire application object. An application object consists of one or more entries in a database table, or entries from more than one database table that are linked using foreign key relationships.
    Before you can set an SAP lock in an ABAP program, you must first create a lock object in the ABAP Dictionary.

Maybe you are looking for

  • Installation Without Bundlet JRE

    Hi, i want to install JSC but it sends me that it can not start graphical mode. i already know what the problem is: i'm installing JSC in my linux machine, but it java has a bug about xde, and xinerama, i already found a workaround for this, java and

  • What is the shortcut for switching to the previous window?

    Hello everybody, Sorry to trouble you with such a simple problem, but I can't find it in the "Help" menu. What is the key board shortcut for going back one window. From a folder window, I can click the left arrow (upper left) but what is the short cu

  • Query Regarding SAP SCRIPT

    I have a normal report output with a field "HIDE" to make it interactive. When clicked on any of the values of this field(s), the value (say VBELN) has to be passed to SAP SCRIPT and all the SELECT QUERIES needs to be written in SAP SCRIPT to get the

  • Can I use apple remote with if1 speakers?

    I have a fourth generation ipod and I am thinking about buying a sonic impact ifusion or if1 as it is also called. It does not come with a remote and I was wondering if I could use the apple remote with it? if some one owns one of these or knows anbo

  • Is there any way to change the background colour in Photoshop Elements 8?.

    Is there any way to change the background colour in Photoshop Elements 8?  There are two options offered in General Preferences, Appearance Options - Dark Grey or Light Grey - but even the Light Grey is much darker than that in Photoshop CS2.  I woul