Locking concept

Hi All,
If i make correction in the webdynpro for the particular transaction and the same time i am making some correction in the same transaction in R/3 .
how does the lock object will work in this scenario.
Thanks & Regards
Ganesan

Hi,
Let's say we are using PA30 and maintaining Address Infotype.
So, you have opened PA30 for a particular employee in CHANGE MODE.
And when you try to access the same employee's Address Infotype data, you will obiviously your Lock function module say ENQUEUE_EPPRELE will not get a lock for that object. It returns an error.
So, you will not be achieve lock through WD Application.
Regards
<i><b>Raja Sekhar</b></i>

Similar Messages

  • Persistence Service Lock Concept

    Hi,
    I found this link thru search ...
    "http://help.sap.com/saphelp_nw04/helpdata/en/f5/a3682ebc6911d4b2e80050dadfb92b/content.htm".
    Part of it says...
    " At present, we have not implemented a Persistence Service lock concept, which would ensure that there was only one transient mapping for each persistent object. So ultimately, ABAP programmers are not really working with persistent objects as such; rather, the Persistence Service makes it appear as if they are."
    Is there already a lock concept in ERP7.0?
    Thanks,
    Huntr

    I found out that persistent object locking when using the persistence services can still be handled by using the classic "ENQUEUE" funtion module.

  • SAP Lock Concept - Wich User Locks my TCode

    Hey Experts,
    i am using the SAP Lock Concept in my Transaktion, but i have a problem to find out how to get the Name of the User how locks my Tcode.
    I build in the Function 'ENQUEUE_EZ_SMARTFORMS',
    after that i print out a Message thet the 'Tcode gets edit by another User at the moment'.
    Now i want to replace 'another User ' with the User-Name of the User.
    Thanks for Help

    Hi,
    fm ENQUEUE_READ will give you the informations you want.
    Pass th name of thge lock object to parameter GNAME, pass the lock argument to parameter GARG and pass SPACE to argument GUNAME.
    Sample:
    * Call custom lock object
      CALL FUNCTION 'ENQUEUE_MYLOCKOBJ'
        EXPORTING
          sase           = xv_sase
          _scope         = '3' "till the end
        EXCEPTIONS
          foreign_lock   = 1
          system_failure = 2
          OTHERS         = 3.
    * Check return code
      CASE  sy-subrc.
        WHEN  0.      "lock successful
          xv_lock                 =  'X'.
        WHEN  1.      "foreign lock
          xv_uname                =  text-unk.
          CONCATENATE                sy-mandt
                                     xv_sase
                               INTO  xv_garg.
          CLEAR                      xt_enq.
          CALL FUNCTION 'ENQUEUE_READ'
            EXPORTING
              gname  = xk_gname_sase
              garg   = xv_garg
              guname = space
            TABLES
              enq    = xt_enq
            EXCEPTIONS
              OTHERS = 4.
          IF  sy-subrc           EQ  0.
            READ  TABLE              xt_enq
                               INTO  xs_enq
                              INDEX  1.
            IF  sy-subrc         EQ  0.
              xv_uname            =  xs_enq-guname.
            ENDIF.
          ENDIF.
          MESSAGE  s000(38)
                       DISPLAY LIKE  'E'
                               WITH  text-sas
                                     xv_sase
                                     text-m07
                                     xv_uname.
          EXIT.
        WHEN  OTHERS.  "unknown lock error
          MESSAGE  s000(38)
                       DISPLAY LIKE  'E'
                               WITH  text-sas
                                     xv_sase
                                     text-m04
                                     sy-subrc.
          EXIT.
      ENDCASE.
    Regards,
    Klaus

  • Lock concept

    Hi peers,
    what does the _scope parameter specify in the enque<xxxx> and dequeue<xxxxx> function modules in locking concept.  what does _scope = '3' mean.

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

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

  • Lock/Password in pdf of Adobe forms

    Hi,
    I want to include password /lock concept means when user run the program the pdf should be downloaded with password. so that only the person who runs the report can able to see the output using the password

    Hi Anurodh,
    Just do the following:
    1. Put all the subforms in a single subform your pdf form.
    2. Create another subform to get password from user. On it create a password field and a button.
    3. Now suppose in your pdf the main subform let 'A' contains subforms A1, A2, A3. A3 is password form.
    4. Then write the following code in the form:ready event of the A:
    $.A1.presence =  "hidden"
    $.A2.presence =  "hidden"
    5. Write the following code in the click event of the button on the subform for password i.e. A3.
    if( PasswordField1.rawValue == "password" )
    then
    A.A1.presence = "visible"
    A.A2.presence = "visible"
    $.parent.presence = "hidden"
    else
    $host.messageBox("Wrong Password!!!!!")
    endif
    Hope it will help to create a password protected pdf form.
    Regards,
    Vaibhav Tiwari.

  • Locks problems with STS

    Hi,
    I am working with BPS into BI 7.0, and its STS. The user goes to the STS web page and takes a node A and changes its status to "In process" and its brother node B is "Send to approval".
    The node A is locked; the message said "An exclusive lock was set in subplan AA planning session BB for the transaction data. For this reason, you can only display the data. ... In the case Botton up ( it is my case), set automatically when a subplan was send for approval or was approval, but the node is "in process" and that node has only one planning folder.
    Thanks for your help.
    Victoria

    Hello Victoria,
    This is a weakness of STS regarding the locking concept, that it is not able to determine on which node the user is operating.
    Once there is one lock set for a specific user, this user is not allowed to open a planning layout out of STS. (beside the auth. object R_STS_SUP)
    You can debug this yourself. You can find this in function module UPS_CHECK_LOCKS_IN_HIER.
    Greetings
    Alex

  • 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

  • Lock inheritance with "CALL FUNCTION func IN BACKGROUND TASK"

    I see that the "SAP Lock concept" documentation states that for locks obtained with _scope = '3', all UPDATE tasks (spawned via "CALL FUNCTION func IN UPDATE TASK" inherit the lock (which is released only once all such update tasks and the calling process have requested a DEQUEUE).
    What should happen when instead, I use "CALL FUNCTION func IN BACKGROUND TASK" (for doing the update in a queue)? Are the locks inherited here as well?
    Cheers!

    Hopefully not, as a background task may be executed late. While update tasks are to be executed quickly (if not, administrators should review the system configuration, like increasing the number of UPD workprocesses).
    Solution: In the background task, redo the locks, as if it was a background job.

  • How to LOCK a table in SAP?

    Hi,
    Just wondering is there a way we can lock a table in SAP?
    tcode or something?
    ex. there a tcode to lock tcodes (SM01)
    so wondering if there is a tcode or another method?
    Thanks!

    Hi,
    These are application locks not the database tables lock.
    If you use this function modules (enqeue and dequeue)
    then only it works the concept of locking.If you dont use this fms then you can directly access the table.
    If I am the developer and I dont implement the  locks then no locking concept would happen.
    Regards,
    Vamshi.

  • Commit after locking database ?????

    Hi Experts.,
    Is it necessary to commit work though i am holding a lock on a database ??
    reasons and example needed............
    <REMOVED BY MODERATOR>
    Edited by: Alvaro Tejada Galindo on Jun 12, 2008 2:19 PM

    Hi,
    The database system uses locks to ensure that two or more users cannot change the same data simultaneously, since this could lead to inconsistent data being written to the database. A database lock can only be active for the duration of a database LUW. They are automatically released when the database LUW ends. In order to program SAP LUWs, we need
    a lock mechanism within the R/3 System that allows us to create locks with a longer lifetime.
    The Open SQL statements INSERT, UPDATE, MODIFY, and DELETE allow you to program database changes.
    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. A lock object definition contains the database tables and their key fields on the basis of which you want to set a lock. When you create a lock object, the system automatically generates two function modules with the names ENQUEUE_<lock object name> and DEQUEUE_<lock object name>. You can then set and release SAP locks in your ABAP program by calling these function modules in a CALL FUNCTION statement.
    There are two types of lock in the R/3 System:
      Shared lock
    Shared locks (or read locks) allow you to prevent data from being changed while you are reading it. They prevent other programs from setting an exclusive lock (write lock) to
    change the object. It does not, however, prevent other programs from setting further read locks.
      Exclusive lock
    Exclusive locks (or write locks) allow you to prevent data from being changed while you are changing it yourself. An exclusive lock, as its name suggests, locks an application
    object for exclusive use by the program that sets it. No other program can then set either a shared lock or an exclusive lock for the same application object.
    Example :
    The user requests a given flight i.e (on screen 100) display or update it (on screen 200). If the user chooses Change, the table entry is locked; if he or she chooses Display, it is not.
    The PAI processing for screen 100 in this transaction processes the user input and prepares for the requested action (Change or Display). If the user chooses Change, the program locks the relevant database object by calling the corresponding ENQUEUE function.
    MODULE USER_COMMAND_0100 INPUT.
    CASE OK_CODE.
    WHEN 'SHOW'....
    WHEN 'CHNG'.
    <...Authority-check and other code...>
    CALL FUNCTION 'ENQUEUE_ESFLIGHT'
    EXPORTING
    MANDT = SY-MANDT
    CARRID = SPFLI-CARRID
    CONNID = SPFLI-CONNID
    EXCEPTIONS
    FOREIGN_LOCK = 1
    SYSTEM_FAILURE = 2
    OTHERS = 3.
    IF SY-SUBRC NE 0.
    MESSAGE ID SY-MSGID
    TYPE 'E'
    NUMBER SY-MSGNO
    WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    At the end of a transaction, the locks are released automatically. However, there are exceptions if you have called update routines within the transaction. You can release a lock explicitly by calling the corresponding DEQUEUE module. As the programmer, you must decide for yourself the point at which it makes most sense to release the locks (for example, to make the data available to other transactions).
    The subroutine UNLOCK_FLIGHT calls the DEQUEUE function module for the lock object ESFLIGHT:
    FORM UNLOCK_FLIGHT.
    CALL FUNCTION 'DEQUEUE_ESFLIGHT'
    EXPORTING
    MANDT = SY-MANDT
    CARRID = SPFLI-CARRID
    CONNID = SPFLI-CONNID
    EXCEPTIONS
    OTHERS = 1.
    SET SCREEN 100.
    ENDFORM.
    You might use this for the BACK and EXIT functions in a PAI module for screen 200 in this example transaction. In the program, the system checks whether the user leaves the screen without having saved his or her changes. If so, the PROMPT_AND_SAVE routine sends a reminder, and gives the user the opportunity to save the changes. The flight can be unlocked by calling the UNLOCK_FLIGHT subroutine.
    MODULE USER_COMMAND_0200 INPUT.
    CASE OK_CODE.
    WHEN 'SAVE'....
    WHEN 'EXIT'.
    CLEAR OK_CODE.
    IF OLD_SPFLI NE SPFLI.
    PERFORM PROMPT_AND_SAVE.
    ENDIF.
    PERFORM UNLOCK_FLIGHT.
    LEAVE TO SCREEN 0.
    WHEN 'BACK'....
    I hope with this example you get a clear picture of lock concept.
    <REMOVED BY MODERATOR>
    Thanks.
    Dhanashri.
    Edited by: Alvaro Tejada Galindo on Jun 12, 2008 2:19 PM

  • How to implement the pessimistic locking using toplink with sybase

    we want to allocate the unique primary key to each row when many user try to insert the records concurrently..So what we are trying to do is we calculate the maximum of Primary Key and incremented it by 1. Now we want to Apply the locking concept on the so that unique key will be allocated to each newly inserted row
    Can you please tell me
    1. how we can genrate unique primary key in toplink using sybase?
    2.how to implement the pessimistic or optimistic locking ?which one will be preferable?

    Hi brother
    I think that this link can help you
    http://download-east.oracle.com/docs/cd/A97688_16/toplink.903/b10064/database.htm#1007986
    Good luck

  • 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

  • Cycles lock in background job of program RKGALKSV5

    Hello All,
    Can we enter more than 1 cycle on the selection screen field (where it says ' Enter Cycles')  when we execute program RKGALKSV5 (Actual Distribution)? In the same job, can we enter more than 1 cycle for this program? We are getting locks for cycle run group 0000 and the first cycle entered (the variant has 3 cycles). Does anyone else have same issue?
    Appreciate your help!
    Thanks,
    Suma

    Hello Ravi,
    Thanks for the help.
    I looked at the note Note 416507 - ALLOCATION: Troubleshooting guide. I did not find any relevant information regarding the locks in cycles. The exact error message I am getting is 'Cycle XXXXXXXXXX 01/01/2007 cannot be started because run group 0000 is locked.' - Error message GA 562.
    I checked couple of SAP notes. Note 70094 - ALLOCATION: lock problem during background processing and Note 967372 - New GL or SL allocation: explaining the lock concept.
    Both the notes explained the lock concept either between cycles running for different company codes or cycles running for different cycle run groups within the same company code. But in our system, we have only one company code and default cycle run group 0000 and only 1 job which executes 3 cycles in the program RKGALKSV5.
    So I had a question, if we can run 3 cycles in the same program, in a single job, for a default cycle run group 0000 within the same company code.
    Thanks,
    Suma

  • How to Lock ABAP Program

    Hi all,
    I am using a module pool program,
    I want to ristrict the access of program to single user at a time.
    can some one give me some clues about program locks.
    Regards,
    Gaurav Sood.

    Hi
    Locking  All Users
    Sometimes it is useful to be able to lock all the users out of a client; for instance, during a client copy (you can also do this with tp locksys, but you have to issue that command from the OS level, and then you can only use DDIC or SAP* to log on). You can use this program to lock out all users except yourself.
    This program (un)locks all the users in a client, except for the current user, and the SAP* user. You might want to add somthing like SELECT-OPTIONS EXEMPTUS FOR USR02-BNAME to allow a list of usernames not to be processed.
    Un/Lock all users in a client
    *& Report YUSRLOCK *
    REPORT YUSRLOCK MESSAGE-ID Z1 .
    TABLES: USR02.
    PARAMETERS: LOCK AS CHECKBOX, LISTLOCK AS CHECKBOX.
    DATA: UFLAGVAL TYPE I, LOCKSTRING(8) TYPE C.
    ---- Authorization check -
    AUTHORITY-CHECK OBJECT 'ZPROG_RUN' ID 'PROGRAM' FIELD SY-CPROG.
    IF SY-SUBRC <> 0.
    IF SY-SUBRC = 4.
    MESSAGE E000 WITH SY-CPROG. "some message about authorization check failure
    ELSE.
    MESSAGE E005 WITH SY-SUBRC. "some message about authorization check failure
    ENDIF.
    ENDIF.
    IF LISTLOCK = 'X'.
    WRITE:/ 'List all locked users: '.
    SELECT * FROM USR02 WHERE UFLAG = 64.
    WRITE: / USR02-BNAME.
    ENDSELECT.
    EXIT.
    ENDIF.
    IF LOCK = 'X'.
    UFLAGVAL = 64. "lock all users
    LOCKSTRING = 'locked'.
    ELSE.
    UFLAGVAL = 0. "unlock all users
    LOCKSTRING = 'unlocked'.
    ENDIF.
    SELECT * FROM USR02 WHERE BNAME <> 'SAP*' AND BNAME <> SY-UNAME.
    IF USR02-UFLAG <> 0 AND USR02-UFLAG <> 64.
    WRITE: 'User', USR02-BNAME, 'untouched; please handle manually.'.
    CONTINUE.
    ENDIF.
    check that user has authority to make these changes
    AUTHORITY-CHECK OBJECT 'S_USER_GRP'
    ID 'CLASS' FIELD USR02-CLASS
    ID 'ACTVT' FIELD '05'.
    IF SY-SUBRC <> 0.
    IF SY-SUBRC = 4.
    WRITE: /'You are not authorized to lock/unlock user ',
    USR02-BNAME, USR02-CLASS.
    ELSE.
    WRITE: /'Authorization error checking user ',
    USR02-BNAME, USR02-CLASS, '(return code', SY-SUBRC, ').'.
    ENDIF.
    ELSE. "has authority
    UPDATE USR02 SET UFLAG = UFLAGVAL WHERE BNAME = USR02-BNAME.
    WRITE: / 'User', USR02-BNAME, LOCKSTRING, '.'.
    ENDIF.
    The SAP Lock Concept
    Reasons for Setting Locks
    Suppose a travel agent want to book a flight. The customer wants to fly to a particular city with a certain airline on a certain day. The booking must only be possible if there are still free places on the flight. To avoid the possibility of overbooking, the database entry corresponding to the flight must be locked against access from other transactions. This ensures that one user can find out the number of free places, make the booking, and change the number of free places without the data being changed in the meantime by another transaction.
    Lock Mechanisms in the Database System
    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. Database locks are therefore never available longer than for only one database LUW. That means that in ABAP application programming, database locks can no longer exist than the duration of one dialog step.
    The physical lock mechanisms in the database system are therefore insufficient for the requirements of an ABAP transaction. The locks 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 not only apply on the application server that carries out the locking transaction, but on all installed servers of the SAP Web AS ABAP.
    SAP Locks
    To complement the SAP LUW concept, in which bundled database changes are made in a single database LUW, the SAP 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 complete documentation on SAP locks can be found in The SAP Lock Concept. This is a short introduction within the environment of ABAP programming.
    The SAP lock concept is based on lock objects. Lock objects allow you to set SAP locks for entire application objects. 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. A lock object definition contains the database tables and their key fields on the basis of which you want to set a lock. When you create a lock object, the system automatically generates two function modules with the names ENQUEUE_Name and DEQUEUE_Name. You can then set and release SAP locks in your ABAP program by calling these function modules in a CALL FUNCTION statemenT.
    Reward If Helpfull,
    Naresh.

Maybe you are looking for

  • Should I 'uninstall' old Firefox updates after installing Firefox 8?

    I'm strictly a "button pusher" and have no clue to the 'how' a computer or its programs work. I had Firefox 1.0.6. 3.5.5, on up to 3.6.8 and I've just installed the latest Firefox 8. Am I supposed to get rid of the old versions or just leave them on

  • HT4108 Dvi on iPhone for TV shows

    Will a digital av adapter plus an hdmi to dvi adapter work to play movies any tv from my iphone5?

  • Preprocess Program for MM_EBAN (ECC 5.0)

    Hello everyone, I am currently trying to add the Preprocess program to the achiving transaction SARA.  Our version us 5.0.  I am unable to locate the program that does the Preprocessing.  Currently the system is configured for RM06BW30 for the Write

  • Another question re:daisychaining lacie, canon, g5

    I read the post from a few days ago about problems capturing while a lacie is plugged in at the same time that a Canon camcorder is plugged in and I have encountered the same problem (I am using FCE). I also read how someone said they have dealt with

  • EXC_BREAKPOINT (SIGTRAP) helpdat issues

    Whenever I go to use the "Help" Function in FCP, it crashes and usually gives me a similar crash report. If it is any help, here is the latest crash report: Process: helpdatad [19281] Path: /System/Library/PrivateFrameworks/HelpData.framework/Version