Shared Lock

I am using a customized screen to upload a material. How to perform a shared lock... for eg., if a user is editing a particular material(m100) then if any other user tries to edit the same material, he should not be able to edit... he should be able to only view the details in that screen.

Hi,
Do the following
1. Go to Se11 :you will find the option Lock object (Naming convetion should be followed Example : EZ_ )
2.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).
3.The maintenance screen for lock objects is displayed.
4.Enter an explanatory short text
5. Enter the name of the primary table
6,Select the lock mode
Save your entries.
Now with help of foll code call the lock in se38 pgm.
CALL FUNCTION 'ENQUEUE_E_TABLE'
EXPORTING
tabname = 'ZTABLE'
EXCEPTIONS
foreign_lock = 1
system_failure = 2
OTHERS = 3.
Now do  your coding here
**************Unlocktable:
CALL FUNCTION 'DEQUEUE_E_TABLE'
EXPORTING
tabname = 'ZTABLE'.
Please reward points.

Similar Messages

  • How to implement the shared lock in a  table view

    Hi,
    How to implement the shared lock in a  table view.for multiple users to edit on this same table.
    Thanks in advance
    Swathi

    Hi,
    Please refer this link to find solution to your querry.
    Hope it helps.
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/c322c690-0201-0010-fb86-811c52b0acc2.
    Regards,
    Rahul

  • How to prevent shared locks in SELECT statement?

    Hi,
    In SQL Server we can use (NOLOCK) to prevent shared locks on each row:
    Select * from table (NOLOCK)
    Do we have similar technique for oracle so it doesn’t consider a shared lock for each returned row?
    Thank you,
    Alan

    Yes - it's called a query ;-)
    Oracle was designed with a 'consistent read' mechanism that guarantees that a query will see the image of the data at the moment when the query started, regardless of the number of updates (including deletes) that have occurred since the query started. This is done using the rollback (aka undo) segment. Flip side - there is no such thing as a 'dirty read'.
    Because of the implementation, a simple select or subselect without coersion (such as the 'FOR UPDATE' clause) will not block writers, nor will writers (updates/inserts/deletes) block readers.
    In addition, an update in Oracle will only lock the rows affected by the update, there is no escalation of locks needed (or possible), and commits do not introduce any 'lock clearing' overhead.
    The penalties for all of this
    - the rollback segment must be sized appropriately or you end up with ORA-01555 errors;
    - you should not commit in loops, especially not loops controlled by a cursor;
    - code written to be efficient in SQL Server is often inefficient in Oracle, and vice versa.
    Recommended reading is Tom Kyte's book at http://www.apress.com

  • How to create shared lock

    Hi,
    Can any please tell me how create a shared lock in steps.
    Thanks in advance
    Priya

    Hi Swati,
    This may not be possible, because you have created shared lock for the four different views but the table is one.
    So when one is editing then definitely if the other try to access the same entries then the object will be locked.
    First understand how and which lock can do which type of action.
    For your assistance read this and try to find the answer.
    Exclusive lock
    The locked data can be read or processed by one user only. A request for another exclusive lock or for a shared lock is rejected.
    Shared lock
    Several users can read the same data at the same time, but as soon as a user edits the data, a second user can no longer access this data. Requests for further shared locks are accepted, even if they are issued by different users, but exclusive locks are rejected.
    Exclusive but not cumulative lock
    Exclusive locks can be requested by the same transaction more than once and handled successively, but an exclusive but not cumulative lock can only be requested once by a given transaction. All other lock requests are rejected.
    Cheers!!
    VEnk@

  • How to Implement shared lock

    Hi friends,
    For a table I have created views. I want to create shared lock for that table.
    How to achieve that.
    can we create shared lock for views?
    Thanks.

    Hi Pagidala,
    Go to Se11-> Select Lock object radiobutton->give some name starting with E for example EZDEMO_LOCK->click on Create ->give short description->clcik on Tables Tab->give the table name for which you want to implement shared lock example ZTABLE ->lock mode you select as Read Lock.After this save check and activate your lock object.
    We have selected READ LOCK since it 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.
    Check the below link for the complete information on Lock Concept.
    http://help.sap.com/saphelp_nw04/helpdata/en/41/7af4c5a79e11d1950f0000e82de14a/content.htm
    Cheers!!
    VEnk@
    Edited by: Venkat Reddy on Oct 29, 2008 11:54 AM

  • How to avoid shared locks when validating foreign keys?

    I have a table with a FK and I want to update a row in that table without being blocked by another transaction which is updating the parent row at the same time. Here is an example:
    CREATE TABLE dbo.ParentTable
    PARENT_ID int NOT NULL,
    VALUE varchar(128) NULL,
    CONSTRAINT PK_ParentTable PRIMARY KEY (PARENT_ID)
    GO
    CREATE TABLE dbo.ChildTable
    CHILD_ID int NOT NULL,
    PARENT_ID INT NULL,
    VALUE varchar(128) NULL,
    CONSTRAINT PK_ChildTable PRIMARY KEY (CHILD_ID),
    CONSTRAINT FK_ChildTable__ParentTable FOREIGN KEY (PARENT_ID)
    REFERENCES dbo.ParentTable (PARENT_ID)
    GO
    INSERT INTO ParentTable(PARENT_ID, VALUE)
    VALUES (1, 'Some value');
    INSERT INTO ChildTable(CHILD_ID, PARENT_ID, VALUE)
    VALUES (1, 1, 'Some value');
    GO
    Now I have 2 transactions running at the same time:
    The first transaction:
    SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;BEGIN TRAN
    UPDATE ParentTable
    SET VALUE = 'Test'
    WHERE PARENT_ID = 1;
    The second transaction:
    SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;BEGIN TRAN
    UPDATE ChildTable
    SET VALUE = 'Test',
    PARENT_ID = 1
    WHERE CHILD_ID = 1;
    If 'UPDATE ParentTable' statement runs a bit earlier, then 'UPDATE ChildTable' statement is blocked untill the first transaction is committed or rollbacked. It happens because SQL Server acquires shared locks when validating foreign keys, even
    if the transaction is using read uncommitted, read committed snapshot (read committed using row versioning) or snapshot isolation level. I cannot see why change in the ParentTable.VALUE should prevent me from updating ChildTable. Please note that ParentTable.PARENT_ID
    is not changed by the first transaction, which means that from FK's point of view whatevere is set to the ParentTable.VALUE is never a problem for referential integrity. So, such blocking behavior seems to me not logical. Furthermore, it contradicts to the
    MSDN:
    Transactions running at the READ UNCOMMITTED level do not issue shared locks to prevent other transactions from modifying data read by the current transaction. READ UNCOMMITTED transactions are also not blocked by exclusive locks that would prevent the
    current transaction from reading rows that have been modified but not committed by other transactions. 
    Does anybody know how to workaround the issue? In other words, are there any tricks to avoid shared locks when validating foreign keys? (Disabling FK is not an option.) Thank you.
    Alexey

    If you change the primary key of the parent table to be nonclustered, there is no blocking.
    Indeed, when I update ParentTable.VALUE, then:
    in case of PK_ParentTable is clustered, a particular row in the clustered index is locked (request_mode:X, resource_type: KEY)
    in case of PK_ParentTable is non-clustered, a particular physical row in the heap is locked (request_mode:X, resource_type: RID).
    and when I update ChildTable.PARENT_ID, then:
    in case of PK_ParentTable is clustered, this index is used to verify referential integrity:
    in case of PK_ParentTable is non-clustered, again this index is used to verify referential integrity, but this time it is not locked:
    It is important to note that in both cases SQL Server acquires shared locks when validating foreign keys. The principal difference is that in case of clustered PK_ParentTable the request is blocked, while for non-clustered index it is granted.
    Thank you, Erland for the idea and explanations.
    The only thing that upsets me is that this solution cannot be applied, because I don't want to convert PK_ParentTable from clustered to non-clustered just to avoid blocking issues. It is a pity that SQL Server is not smart enough to realize that:
    ParentTable.PARENT_ID is not changed and, as a result, should not be locked
    ChildTable.PARENT_ID is not actually changed either (old value in my example is 1 and the new value is also 1) and, as a result, there is no need at all for validating the foreign key.
    In fact, the problem I described is just a tip of the iceberg. The real challenge is that I have deadlocks because of the FK validation. In reality, the first transaction has an additional statement which updates ChildTable:
    SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;
    BEGIN TRAN
    UPDATE ParentTable
    SET VALUE = 'Test'
    WHERE PARENT_ID = 1;
    UPDATE ChildTable
    SET VALUE = 'Test'
    WHERE PARENT_ID = 1;
    The result is famous message:
    Msg 1205, Level 13, State 51, Line xx
    Transaction (Process ID xx) was deadlocked on lock resources with another process and has been chosen as the deadlock victim. Rerun the transaction.
    I know that if I change the order of the two statements, it will solve the deadlock issue. But let's imagine I cannot do it. What are the other options?
    Alexey

  • "no enough space to create shared lock" Error Occured

    Hi, Everyone
    After creating a new Sales Order in the CRM System, there was a Error "no enough space to create shared lock".
    who have met this issue before?Please tell me, thanks a lot.
    Best Regards,
    Bonnie Spear

    Hi Bonnie,
       Shared Lock means Several users (transactions) can access locked data at the same time in display mode.
    Requests from further shared locks are accepted, even if they are from different users.
    But if you are creating a new sale order this should not occur. May be you should check your customizing settings.There may be some problem in that.
    Hope this helps.
    best regards
    Sourabh

  • Mutex shared lock while reading/writing files

    Hi,
    My application is a single threaded application. And I am trying to do the read/write file operation.  But there is a chance that other process may read/write the same file while i am using. So before reading or writing the file, i want to mutex shared
    lock.
    So can please some one tell me how to prevent this situation. Is there some sample code. I checked in net, how to use mutex shared lock, i got some example, but every where before using the mutex loxk, a thread needs to be created. Since my application is
    a single threaded, so i dont want to create a new thread.
    So please help me, how to prevent/stop other process to access the same file while my application is using.
    THanks a lot in advance.

    That's not something that a mutex can help with. Other processes won't know about your mutex and even if they know that's overkill. Normally you simply open that file without allowing read/write sharing - in the case of CreateFile that in general means that
    you pass 0 for the dwShareMode parameter.
    If you use the C runtime functions then you can use fopen_s instead of fopen as it automatically disallows sharing if you open the file for write (if you open for read when it allows shared read which is the normal thing to do).

  • Avoid assigning to servlet static fields without using a shared lock??

    Hi
    i received the following warning on my code, does anyone give me a help on this? Thanks
    "Avoid assigning to servlet static fields from javax.servlet.Service.service () without using a shared lock."
    And my code are as follow:
    public class MyDataSource {
        private static DataSource ds = null;
        public static DataSource getDataSource() throws NamingException, Exception
            if (ds==null){
                   InitialContext ctx = new InitialContext();
                try{
                    synchronized(getDataSource()){
                    if(ds==null){
                        ds = (DataSource) ctx.lookup(SysProperties.ds);
                } catch (Exception ex) {
                    throw new Exception("DBConnection Exception: " +ex.toString());
                }finally{
                        if(ctx !=null){
                            ctx.close();
            return ds;       
    }

    The service method of a servlet is multi-threaded to handle multiple requests. Hence,any static or public fields accessed by the service method should be restricted to a single thread access (for example using synchronized keyword) to make it thread-safe. That is why you are getting the warning message.

  • Shared lock vs exclusive lock

    Hello
    I have a question.
    If we have two scott sessions. I am updating a table EMP in session 1. It means it is exclusively locked.It cannot be used by session 2. Then can we use select command on table EMP in session 2.?? This command shoul not work according to me. But it is working.
    Reply me.
    Thanks in anticipation.

    984426 wrote:
    But in shared / exclusive lock, we have a property that we can't acquire shared lock on data if it is exclusively locked and vice versa. that means readers block writers and vice versa.
    E.g. if T1 is updating a row then how T2 can read that row? If T2 is reading then that is inconsistent data as it will pick the non-updated value of that row until T1 commits.
    Please explain.
    I am having doubts in this topic.
    ThanksYou need to check back again the basic concepts from the Concepts guide. Your understanding about the Oracle's working is completely wrong.
    In Oracle, the Transaction Isolation Level is set to Read Committed . This means any kind of inconsistent data is not possible to be read by you and for that data , Oracle would create for you a consistent image using the Undo Blocks in which the old image is going to be stored till the time that transaction is not over( and even after that too for some time with conditions apply) . So if T1 is updating a row, T2 can't lock the same row as it would be locked exclusively and the S1 (another select) would be seeing an old and consistent image of that change only as long as it's not committed. What you said doesn't and won't work ever in Oracle.
    Read the first link that's given to you already.
    Aman....

  • When shared locks are relesed in read committed.

    hi,
    https://msdn.microsoft.com/en-us/library/cc546518.aspx
    following lines are form above link
    "shared locks are acquired for read operations, but they are released as soon as they have been granted"
    Q1) Are they released after the stmt is executed " select * from a" or they are realease after the row is read and it continues with second row.
    Q2) As far as acquiring of shared lock is concerned i think they are acquired row by row , and mean  while other transaction can update rows which are not having shared lock till now , like last rows?
    yours sincerley

    That means.
    if a stmt select three rows.
    Q1)Then will it get shared lock for first row, reads it, release the lock, then take shared lock on second row and read it then release it again after reading the second row , then it will get thired row lock ....?
    Q2) As far as acquiring of shared lock is concerned i think they are acquired row by row , and mean  while
    other transaction can update rows which are not having shared lock till now , like last rows?
    Q1) Yes, in read committed mode when your query does not have any hints to change the behavior, if a query is only reading data from a table (like a SELECT statement), then the lock on each row is taken just before the row is read, the row is read, the lock
    is freed and it goes on to the next row and does the same process on that row (lock, read, free).
    Q2) Yes, the locks are acquired on a row basis.  Since they are then freed, your query will not stop other connections from updating rows in the table(s) you are reading except for the vary short period of time the lock is held on each row.  So
    your query could read lock row 1, read row 1, free the lock on row1, get a lock on row 2 and be in the process of reading row 2 when some other connection updates row 1.  That connection would be allowed to update row 1.
    Tom

  • Home sharing locks up iTunes

    I have windows XP and am trying to initiate home sharing.  When I en my ID and password into ITunes and select create home sharing, ITunes completely locks up.  I'm using the latest version 10.2.2.14, does anyone have a thought on how to fix?  I have tried numerous times with all applications closed, firewall off and antivirus disabled.  Thank you!

    Oh... just to make it more bizarre, I have a second iMac and was able to set it up with Home Sharing but since it's not the main computer, I only get Music and Podcasts or something. Still attempting to figure out the other mess though.

  • System preference/sharing lock icon permissions

    i would like to find a log of system preferences / sharing , that would show when the lock icon is becoming unlocked on its own.
    the OS is up to date with current software updates.
    when i do open system preference / sharing from the doc, sharing is unlocked.
    this has happened many times.
    now i keep system preference sharing or network in eyeball view during any session and off to the side so i can watch the lock icon. and the lock icon stays in a lock position. i have expereinced that if i close system preference and then re open some other time days, the lock icon would be open in sharing or network.
    I have searched in console logs, yet i do not know precisly what key words or phrases or alphanumeric combo would or could id actions in system preferences or if i could actually find any hint of unlock action of and in system preferences in console. every other action detail is in there, so it seems.
    what could i do.
    thank you

    Open the Security pane of System Preferences and check whether System Preferences is set to require a password to unlock each secure pane. If it's not, simply being logged in as an administrator will unlock all the panes except for Accounts.
    (45190)

  • Shared Lock --Blocking Process

    Team,
    I have a sp with dynamic sql, which have around 1500 update stmts.
    When i run this proc in prod, am getting alerts that this sp is blocking the process in prod server and it shows lock type as
    Lock: Sch-S . How can i avoid this ?

    Hello SSDL
    Is this still an issue?
    If not, then please close the thread, by marking answers and voting usefull responses.
    Thanks!
    p.s.
    >> I saw that you use temporary table. make sure that this is not a global temporary table since it might be a reason for your lock, if you try to change the table on several sessions on the same time.
    >> You say that this SP block something. Try to monitor "what is blocked" and not just who is blocking,
    >> If you need more help please ADD the SP code + check isolation levels and post it + more information on what is blocked
    >> Check that you are not using truncate (this is common issue that people forget
    TRUNCATE is a DDL statement and requires a Sch-M lock on the object).
    [Personal Site] [Blog] [Facebook]

  • Quotation Error: Not enough space to create shared lock !!!

    Hi
    I am trying to create a quotation and am getting the error above after I enter the product. Can anyone help with this? there is no long text for this error.
    Regards
    Avi

    Hi
    This problem may be related to IPC or XCM (if web related)
    check the IPC Server setting
    if XCM
    http://hostname:port/shopname/admin/xcm/init.do
    then go to "Application configurations --> customer --> your configurationname.
    There you've a field "ipcdata"...and this should have the value "noipc"?
    hope this helps
    Regards
    Manohar

Maybe you are looking for

  • Very slow running seems to be com.apple.appkit.xpc.openAndSavePanelService

    At unpredictable times my iMac starts to run really slow and I can hear the disk churning away. Looking in console I get a whole load of errors relating to: 2/13/14 5:09:07.197 PM com.apple.appkit.xpc.openAndSavePanelService[7321]: ERROR: CGSSetWindo

  • OBIEE 11g Dashboard Prompts

    Hi, I need some help on possible designs for dashboard prompts. We have a number of prompts which are based on SQL Results (custom query) in some dashboards. Unfortunately obi cannot "Limit values by" or constrain values returned by the selected valu

  • Rebate Agreement Replication CRM to R3 and vice-versa

    Hi All, We have a requirement of creating Rebate Agreement and maintaining the conditions in the same. When we create an order (in R3 or CRM) the values has to be populated from the rebate agreement. Scenario A: The setup of rebate is completed in R3

  • Installation of Solaris 10 fails at booting kernal

    Booting kernal/unix... SunOS Release 5.10 Version Generic 32-bit Copyright 1983-2005 Sun Mircosystems, Inc. All rights reserved. Use is subject to license terms. Nothing happens for a minute or so, then the following appears. WARNING: /pci@0,0/pci-id

  • Printer Sensor

    Having a problem with HP Color LaserJet 3800 Printer toner cartridge sensor is saying that toner is out when the color has not even begun to fade and then of course the printer stops printing. Anyone else had this problem or know how to fix it?