How we can lock No more than one user can use the table  at a single time

Hi Abapers,
0)  which  function modules to lock & unlock a table.
1) When you execute the program, we can check if there is any lock on this table. If yes, the user should be able to only view the table contents and not modify.
2) If there is no lock, then lock the table and go into change mode.
3) On exiting from the program, unlock the table using the function module.
4) more than one user can't modify the table just display.
Note: If there is any lock, display message saying table is locked.
Plz help me for this requirement.
Thanks
Nani

Hello Nani
Have a look at the lock object EMMARAE (<i>Lock MARA and MARM/MAKT exclusively</i>) in transaction SE11.
Inspect the F1 help for field <b>Lock mode</b>:
DE ENQMODE
Short Text
     Lock mode
Definition
     Defines how to synchronize table record access by several users.
The following modes exist:
     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.
If you want to lock a standard table search whether the table is used in lock objects (<i>Where-Used-List</i>). If it is a customer table you have to create your own lock object (including two function modules: one for enqueuing and the other for dequeuing).
The lock modules can be found in menu <b>GoTo -> Lock Modules</b>.
Given these lock modules the logic should be quite clear after starting the program:
1. Request lock -> if successful, continue in Change mode; -> if failed, continue in Display mode
2. Before leaving the report remove lock (note: no problem if no lock has been set in the beginning).
Regards
  Uwe

Similar Messages

  • How can I restrict more then one user to access the table?

    Hi !
    I have a problem and two solutions and I am a bit confused as to
    which one is the best one and/or can there be any better way of
    handling the problem ?
    Problem : I have to update a key field of a table when I update
    it in the form 5.0 screen. I am basically doing a maintenance of
    a table and if a certain field is updated then the change has to
    be reflected in two more tables. But the issue is that the field
    is a part of the key in those two tables. So all I can think of
    is that I need to insert new set or rows for that new value of
    the field and delete the old set of records for old values of
    the field.
    There are two ways of doing it;
    1.One option can be to explicitely define two cursors separately
    and fetch the values in them one by one and then insert the new
    records and then delete the old records in both the tables. This
    I feel will be a cumbersome process both in terms of processing
    time and the coding.
    2.Second option I was thinking can be to create two flat tables
    (without keys) and insert the values in them and update the
    changed field there and then insert the rows in the respective
    tables. Delete the old records in the main tables and delets the
    records in these flat tables. This is a bit more faster and
    easier to predict and code. This seems to be a better option for
    me.
    Any comments on these ?
    In both the cases I was thinking of making some provision so
    that more then one person can't update the table simultaneously.
    Since if there are more then one persons doing the processing
    then some inconsistency might creep into the whole process.
    This is easier to do in the second process as if I check the
    data in the flat tables and if there is some data then I can
    presume that some one is doing the processing and I can ask the
    other person to hold for a while. But in this case how can I
    stop more then two people to simultaneously check for the empty
    table and start inserting the record ?
    I was just thinking of having a sepatare table having only one
    field and this will be a key field and as the process begins the
    process will insert a fix value say 'Y' in the key field and at
    the end of the process the record will be deleted and this way
    we can restrict the user to access the process more then one at
    a time..? Since you can't have same value of the key in a table
    more then once.
    Any better way of handling it will be deeply appreciated.
    How about locking the table at the begining and releasing the
    lock at the end ? Will there be any issue in that? since I am
    inserting and deleting the rows in the same transaction.
    Comments welcome,
    Shobhit
    null

    How about performing the update IN the database using a stored
    procedure?
    By using non-database fields on your form to get the
    information, you can then call the procedure in the database to
    perform the updates. If an error occurs in the procedure you
    rollback, if necessary, and send a message or status back to the
    form. If it succeeds you might wish to commit and then re-
    execute the form's query -- using either the original key values
    or the new key values...
    null

  • Can I put more than one user under one Apple ID account. I want to let other family members use imessage on their own Apple device. Or is there another way to get this end result?

    Can I put more than one user under one Apple ID account. I want to let other family members use imessage on their own Apple device. Or is there another way to get this end result?

    You can seach the net for solutions like this one http://appletvvpn.com/how-to-connect-apple-tv-2-to-vpn/ another idea is to use a PC as the control and fit that with a wireless card and set up a ad hoc wireless network that the Apple TV uses. 

  • Can I assign more than one Pricing procedures to the one vendor.

    Hi Gurus,
    Can I assign more than one Pricing procedures to the one vendor.
    If possible, where it can assign &give the procedure.
    My client requirement is :
    Vendor supply the goods from two different countries. So, pricing procedure is different because taxes are differ in two countries and currency also differs.
    If goods are supplying from country u2018Au2019 ,automatically pricing procedure for that country  was trigger. How the system know , which pricing schema is required.
    Give me solution

    Hi,
    Extend your vendor to new purchase organisation.  Assaign new pricing procedure to this Purchase organisation.
    Use different Purchase organisation while creating POs for the same vendor  procuring from different countries.
    Regards,
    Satya
    Edited by: Penjarla Venkata Satyanarayana on Aug 28, 2008 4:21 PM
    Edited by: Penjarla Venkata Satyanarayana on Aug 28, 2008 4:23 PM

  • Can you have more than one user on the new ipad?

    Can you have more than one user on the new ipad?

    You cannot set up more than one user account on the iPad if that is what you mean.
    Obviously families will share an iPad, but they are really meant to be single user devices with one Apple ID only on the iPad. Multiple ID's on one iPad can become a bit of a hassle to deal with.
    There is no way to lock apps or email accounts so that can become an issue as well. If you use the built in mail app for email, whoever is using the iPad can read your email.

  • HT4759 Can you have more than one computer linked to the same icloud account?

    Can you have more than one computer linked to the same icloud account?  If so how do you add a computer?

    Yes, of course - that's the whole point, to provide syncing of data such as calendars, contacts and email between computers and iOS devices. Having got iCloud up and running on one computer, simply sign all other devices in at System Preferences (or Settings)>iCloud with the same login. (Lion 10.7.2 and iOS5 are the minimum requirements.)

  • Can i Bind more than one Model object to the Custom controller or not

    Hi All, I trying to bind more than one model object to the custom controller, Both the model objects contains same attribute name called ( output). Both model objects created on to top of the BAPI. So when i bind first model object to the custom controller will work fine. When i am trying to bind the second model object to the same controller. This second model object also having the same attribute name called "output" . So it is giving an error of "Duplicate context element "Detail". Rename or uncheck duplicate elements.
    can i assign more than one model object to the single controller or not?
    But in the reference document, it has given that , we can create model object with more than one bapi.So in this case if both the bapis contains any element with the same name will also be problem. Any body give me the solution.
    Initially we have created one custom controller for each model object. But later i realized that, why con't we use same controller for all the model object. Because, the custom controller context is the public context. this context shared across all the view controllers.
    The concept which I am trying to do is right or wrong?

    Hi Vishal,
    of course, you can bind one controler to many models. When the same name occours you can simply RENAME binded node in controler.
    Regards
    Bogdan

  • Can i have more than one ipod touch on the same account, or must they both be set up with different id's.

      Can I have more than one ipod touch on the same account, or must they each have their own ID.

    If you use the same account see the following to separate Messages and FaceTime between the two iPod see:
    MacMost Now 653: Setting Up Multiple iOS Devices For Messages and FaceTime

  • Can there be more than one JVM Running on the same machine

    Can there be more than one JVM Running on the same machine.

    Even JVM's of different versions (or vendors) can run on the same box at the same time.

  • Can you have more than one apple id under the same account

    can you have more than one apple id under the same account

    Stop using the same Apple ID for iMessage on these devices.  Go to Settings>Messages>Send & Receive (Receive At in iOS 5), tap the ID shown, sign out, then sign back in using a unique ID for each device.  (Or, just sign out and stop using your Apple ID for iMessage.)

  • How Do I Share My Database Between More Than One User Account on the Same Mac?

    How Do I Share My Database Between More Than One User Account on the Same Mac?

    How to use multiple iPhone, iPad, or iPod devices with one computer. The only way is for you to have a separate user account to log into on that computer.

  • HT4859 Can I have more than one icloud account on the same pc I share with my spouse?

    Can I have more than one icloud account on the same pc that I share with my spouse?

    Yes, providing that you use seperate user accounts on the computer.

  • HT2534 can you have more than one itunes account on the same computer?

    can you have more than one itunes account on the same computer?

    Yes. Either create and use separate Windows user accounts, or launch iTunes with the Shift key held down as desired.
    (62377)

  • Can I run more than one "main application" in the same JVM?

    Hi,
    We need a instance of JVM to run each standard application, Applet or Xlet?
    Can I run more than one "main application" in the same JVM?
    Thanks.

    stdioo wrote:
    Hi,
    We need a instance of JVM to run each standard application, Ok
    Applet or Xlet?You have no control over the first on a client machine. Presumably not the second either although I don't know what it is.
    Can I run more than one "main application" in the same JVM?Application. Not applet.
    You must have a class (code) to start each "application". To keep the environments clean from each other you can use a class loader.

  • Can you have more than one iTunes account on the same computer?

    My wife just got a nano and wants to set up her itunes library. Since we have different tastes in music, I thought we should have separate libraries under our separate log-ins to our PC so that her music didn't upload to my iPod and vice versa. Is that the right approach or is there a better way?

    There are basically two ways of using multiple iPods on a computer and these involve:
    a) Sharing a single iTunes library and user account.
    b) Creating multiple user accounts and having separate libraries.
    Sharing a Library
    If you want to share the one library, you can set either or all of the iPods so that they only get updated with only certain playlists (you can update from more than one if you wish):
    Loading songs onto iPod automatically - Windows
    Choosing the update option "Sync Music - Selected playlists" allows you to create a playlist specifically for the iPod and drag the tracks you want into it. If you tire of the list and want to change it, you just add or remove the songs you don't want. The ones you take out out remain in the library to be used some other time if you choose. You can read more about playlists at these links:
    iTunes: Creating playlists of your favorite songs
    How to create a Smart Playlist with iTunes
    Or you can choose to update any or all of the iPods manually and just drag whatever content you want to them: Managing content manually on iPod
    Separate User Accounts
    Another option is to create a separate User account for each person on your PC or Mac. Different accounts by definition would give you completely separate libraries. Each account has it's own iTunes folder, Library and iTunes Music folder and you load it with CDs etc just as you did with your original one. The iPod can be set to update however the owner chooses, sync all, manual or sync specific playlists

Maybe you are looking for