<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: How to Lock ABAP Program in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-lock-abap-program/m-p/3797543#M913360</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Goto -&amp;gt; Attributes -&amp;gt; in the window at below there is Editor lock check box. Check that one.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Raghu&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 22 May 2008 07:06:47 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2008-05-22T07:06:47Z</dc:date>
    <item>
      <title>How to Lock ABAP Program</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-lock-abap-program/m-p/3797542#M913359</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi all,&lt;/P&gt;&lt;P&gt;I am using a module pool program,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I want to ristrict the access of program to single user at a time.&lt;/P&gt;&lt;P&gt;can some one give me some clues about program locks.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Gaurav Sood.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 22 May 2008 07:02:48 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-lock-abap-program/m-p/3797542#M913359</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-05-22T07:02:48Z</dc:date>
    </item>
    <item>
      <title>Re: How to Lock ABAP Program</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-lock-abap-program/m-p/3797543#M913360</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Goto -&amp;gt; Attributes -&amp;gt; in the window at below there is Editor lock check box. Check that one.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Raghu&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 22 May 2008 07:06:47 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-lock-abap-program/m-p/3797543#M913360</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-05-22T07:06:47Z</dc:date>
    </item>
    <item>
      <title>Re: How to Lock ABAP Program</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-lock-abap-program/m-p/3797544#M913361</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi&lt;/P&gt;&lt;P&gt; &lt;STRONG&gt;Locking  All Users&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;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.&lt;/P&gt;&lt;P&gt;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.&lt;/P&gt;&lt;P&gt;Un/Lock all users in a client&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;amp;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*&amp;amp; Report YUSRLOCK *&lt;/P&gt;&lt;P&gt;*&amp;amp; *&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;amp;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*&amp;amp; *&lt;/P&gt;&lt;P&gt;*&amp;amp; *&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;amp;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;REPORT YUSRLOCK MESSAGE-ID Z1 .&lt;/P&gt;&lt;P&gt;TABLES: USR02.&lt;/P&gt;&lt;P&gt;PARAMETERS: LOCK AS CHECKBOX, LISTLOCK AS CHECKBOX.&lt;/P&gt;&lt;P&gt;DATA: UFLAGVAL TYPE I, LOCKSTRING(8) TYPE C.&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="---------" /&gt; Authorization check -&lt;HR originaltext="----------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;AUTHORITY-CHECK OBJECT 'ZPROG_RUN' ID 'PROGRAM' FIELD SY-CPROG.&lt;/P&gt;&lt;P&gt;IF SY-SUBRC &amp;lt;&amp;gt; 0.&lt;/P&gt;&lt;P&gt;IF SY-SUBRC = 4.&lt;/P&gt;&lt;P&gt;MESSAGE E000 WITH SY-CPROG. "some message about authorization check failure&lt;/P&gt;&lt;P&gt;ELSE.&lt;/P&gt;&lt;P&gt;MESSAGE E005 WITH SY-SUBRC. "some message about authorization check failure&lt;/P&gt;&lt;P&gt;ENDIF.&lt;/P&gt;&lt;P&gt;ENDIF.&lt;/P&gt;&lt;P&gt;IF LISTLOCK = 'X'.&lt;/P&gt;&lt;P&gt;WRITE:/ 'List all locked users: '.&lt;/P&gt;&lt;P&gt;SELECT * FROM USR02 WHERE UFLAG = 64.&lt;/P&gt;&lt;P&gt;WRITE: / USR02-BNAME.&lt;/P&gt;&lt;P&gt;ENDSELECT.&lt;/P&gt;&lt;P&gt;EXIT.&lt;/P&gt;&lt;P&gt;ENDIF.&lt;/P&gt;&lt;P&gt;IF LOCK = 'X'.&lt;/P&gt;&lt;P&gt;UFLAGVAL = 64. "lock all users&lt;/P&gt;&lt;P&gt;LOCKSTRING = 'locked'.&lt;/P&gt;&lt;P&gt;ELSE.&lt;/P&gt;&lt;P&gt;UFLAGVAL = 0. "unlock all users&lt;/P&gt;&lt;P&gt;LOCKSTRING = 'unlocked'.&lt;/P&gt;&lt;P&gt;ENDIF.&lt;/P&gt;&lt;P&gt;SELECT * FROM USR02 WHERE BNAME &amp;lt;&amp;gt; 'SAP*' AND BNAME &amp;lt;&amp;gt; SY-UNAME.&lt;/P&gt;&lt;P&gt;IF USR02-UFLAG &amp;lt;&amp;gt; 0 AND USR02-UFLAG &amp;lt;&amp;gt; 64.&lt;/P&gt;&lt;P&gt;WRITE: 'User', USR02-BNAME, 'untouched; please handle manually.'.&lt;/P&gt;&lt;P&gt;CONTINUE.&lt;/P&gt;&lt;P&gt;ENDIF.&lt;/P&gt;&lt;UL&gt;&lt;UL&gt;&lt;LI level="2" type="ul"&gt;&lt;P&gt;check that user has authority to make these changes&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;P&gt;AUTHORITY-CHECK OBJECT 'S_USER_GRP'&lt;/P&gt;&lt;P&gt;ID 'CLASS' FIELD USR02-CLASS&lt;/P&gt;&lt;P&gt;ID 'ACTVT' FIELD '05'.&lt;/P&gt;&lt;P&gt;IF SY-SUBRC &amp;lt;&amp;gt; 0.&lt;/P&gt;&lt;P&gt;IF SY-SUBRC = 4.&lt;/P&gt;&lt;P&gt;WRITE: /'You are not authorized to lock/unlock user ',&lt;/P&gt;&lt;P&gt;USR02-BNAME, USR02-CLASS.&lt;/P&gt;&lt;P&gt;ELSE.&lt;/P&gt;&lt;P&gt;WRITE: /'Authorization error checking user ',&lt;/P&gt;&lt;P&gt;USR02-BNAME, USR02-CLASS, '(return code', SY-SUBRC, ').'.&lt;/P&gt;&lt;P&gt;ENDIF.&lt;/P&gt;&lt;P&gt;ELSE. "has authority&lt;/P&gt;&lt;P&gt;UPDATE USR02 SET UFLAG = UFLAGVAL WHERE BNAME = USR02-BNAME.&lt;/P&gt;&lt;P&gt;WRITE: / 'User', USR02-BNAME, LOCKSTRING, '.'.&lt;/P&gt;&lt;P&gt;ENDIF.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;The SAP Lock Concept&lt;/STRONG&gt; &lt;/P&gt;&lt;P&gt;Reasons for Setting Locks&lt;/P&gt;&lt;P&gt;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. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Lock Mechanisms in the Database System&lt;/P&gt;&lt;P&gt;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.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;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. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SAP Locks&lt;/P&gt;&lt;P&gt;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.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;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.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;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.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;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.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Reward If Helpfull,&lt;/P&gt;&lt;P&gt;Naresh.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 22 May 2008 07:07:52 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-lock-abap-program/m-p/3797544#M913361</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-05-22T07:07:52Z</dc:date>
    </item>
    <item>
      <title>Re: How to Lock ABAP Program</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-lock-abap-program/m-p/3797545#M913362</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Have a look at below link:&lt;/P&gt;&lt;P&gt;[Lock Users|http://www.abapcode.sapbrainsonline.com/2008/03/abap-program-for-lock-all-users.html]&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I hope it helps.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best Regards,&lt;/P&gt;&lt;P&gt;Vibha &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please mark all the helpful answers&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 22 May 2008 07:08:31 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-lock-abap-program/m-p/3797545#M913362</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-05-22T07:08:31Z</dc:date>
    </item>
    <item>
      <title>Re: How to Lock ABAP Program</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-lock-abap-program/m-p/3797546#M913363</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;HI&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Use BAPI_USER_LOCK&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Provide user id and it will lock the user.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Aditya&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 22 May 2008 07:10:08 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-lock-abap-program/m-p/3797546#M913363</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-05-22T07:10:08Z</dc:date>
    </item>
    <item>
      <title>Re: How to Lock ABAP Program</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-lock-abap-program/m-p/3797547#M913364</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Issue resolved&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 27 May 2008 08:16:19 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-lock-abap-program/m-p/3797547#M913364</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-05-27T08:16:19Z</dc:date>
    </item>
    <item>
      <title>Re: How to Lock ABAP Program</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-lock-abap-program/m-p/3797548#M913365</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;This message was moderated.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 08 Apr 2014 13:09:52 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-lock-abap-program/m-p/3797548#M913365</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2014-04-08T13:09:52Z</dc:date>
    </item>
  </channel>
</rss>

