<?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: Check if program is currently running in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/check-if-program-is-currently-running/m-p/3623540#M872964</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;STRONG&gt;Use FM ENQUEUE_ESINDX .&lt;/STRONG&gt; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Change your program so as to call the above FM before the start of the transaction. pass the program name and RELID as 'ZZ'. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So when another user tries to run the transaction, the FM throws an error message saying "Lock not possible". &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this helps. Reward points if helpful.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Balaji&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 02 Apr 2008 17:59:14 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2008-04-02T17:59:14Z</dc:date>
    <item>
      <title>Check if program is currently running</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/check-if-program-is-currently-running/m-p/3623539#M872963</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello all,&lt;/P&gt;&lt;P&gt;I have developed a interactive Z application and I would like to add a routine to check to see if the user executing the program currently in the program in another session. Essentially I'd like to enforce one session of my program per user so if knows the code or function module to check this I would appreciate it.&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 02 Apr 2008 17:54:02 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/check-if-program-is-currently-running/m-p/3623539#M872963</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-04-02T17:54:02Z</dc:date>
    </item>
    <item>
      <title>Re: Check if program is currently running</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/check-if-program-is-currently-running/m-p/3623540#M872964</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;STRONG&gt;Use FM ENQUEUE_ESINDX .&lt;/STRONG&gt; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Change your program so as to call the above FM before the start of the transaction. pass the program name and RELID as 'ZZ'. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So when another user tries to run the transaction, the FM throws an error message saying "Lock not possible". &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this helps. Reward points if helpful.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Balaji&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 02 Apr 2008 17:59:14 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/check-if-program-is-currently-running/m-p/3623540#M872964</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-04-02T17:59:14Z</dc:date>
    </item>
    <item>
      <title>Re: Check if program is currently running</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/check-if-program-is-currently-running/m-p/3623541#M872965</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you for the quick answer, one point of clarification though I would to restrict this by user so if I have 15 users in the program at one time that's OK however if I want prevent a single user from have multiple instances of the same program running. Can this be accomodate via this FM?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 02 Apr 2008 18:22:07 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/check-if-program-is-currently-running/m-p/3623541#M872965</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-04-02T18:22:07Z</dc:date>
    </item>
    <item>
      <title>Re: Check if program is currently running</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/check-if-program-is-currently-running/m-p/3623542#M872966</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You can use function 'THUSRINFO', which will bring you the username and the transaction code, among other parameters. Then, before starting the report, you could check with this function if the user is already executing the transaction.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 02 Apr 2008 18:23:41 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/check-if-program-is-currently-running/m-p/3623542#M872966</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-04-02T18:23:41Z</dc:date>
    </item>
    <item>
      <title>Re: Check if program is currently running</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/check-if-program-is-currently-running/m-p/3623543#M872967</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;To check if program is running&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  SELECT COUNT( * ) &lt;/P&gt;&lt;P&gt;         INTO count&lt;/P&gt;&lt;P&gt;         FROM tbtcp AS p INNER JOIN tbtco AS o&lt;/P&gt;&lt;P&gt;             ON o&lt;SUB&gt;jobname  = p&lt;/SUB&gt;jobname&lt;/P&gt;&lt;P&gt;             AND o&lt;SUB&gt;jobcount = p&lt;/SUB&gt;jobcount&lt;/P&gt;&lt;P&gt;         WHERE p~progname  = sy-repid&lt;/P&gt;&lt;P&gt;           AND o~delanfrep = space&lt;/P&gt;&lt;P&gt;           AND o~status    = 'R'.   &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;IF count NE 1  = program is running&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 03 Apr 2008 04:20:34 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/check-if-program-is-currently-running/m-p/3623543#M872967</guid>
      <dc:creator>kan_sasivimolkul</dc:creator>
      <dc:date>2008-04-03T04:20:34Z</dc:date>
    </item>
    <item>
      <title>Re: Check if program is currently running</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/check-if-program-is-currently-running/m-p/3623544#M872968</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Use FM &lt;STRONG&gt;ENQUEUE_ESINDX&lt;/STRONG&gt; . &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Change your program so as to call the above FM before the start of the transaction. pass a &lt;STRONG&gt;unique name&lt;/STRONG&gt; and RELID as 'ZZ'. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;The unique name could be the program name. Since you want to prevent single user having multiple instances of the same program running, pass the unique name (l_var) as something like this:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;concatenate &amp;lt;program name&amp;gt; &amp;lt;username&amp;gt; into the l_var.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Pass the l_var to the FM instead of the program name. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this helps. Reward points if helpful&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Balaji&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 03 Apr 2008 05:14:31 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/check-if-program-is-currently-running/m-p/3623544#M872968</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-04-03T05:14:31Z</dc:date>
    </item>
    <item>
      <title>Re: Check if program is currently running</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/check-if-program-is-currently-running/m-p/3623545#M872969</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Balaji - Do you have a small sample of code demonstrating this FM with parameters you mentioned?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 03 Apr 2008 14:17:29 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/check-if-program-is-currently-running/m-p/3623545#M872969</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-04-03T14:17:29Z</dc:date>
    </item>
    <item>
      <title>Re: Check if program is currently running</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/check-if-program-is-currently-running/m-p/3623546#M872970</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Check the below code.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;

CALL FUNCTION 'ENQUEUE_ESINDX'
 EXPORTING
   MODE_INDX            = 'E'
   MANDT                = SY-MANDT
   RELID                = 'ZZ'
   SRTFD                = &amp;lt;unique name&amp;gt;  "In your case it will be username combined with program name
*   SRTF2                =
*   X_RELID              = ' '
*   X_SRTFD              = ' '
*   X_SRTF2              = ' '
*   _SCOPE               = '2'
*   _WAIT                = ' '
*   _COLLECT             = ' '
 EXCEPTIONS
   FOREIGN_LOCK         = 1
   SYSTEM_FAILURE       = 2
   OTHERS               = 3
          .
IF sy-subrc &amp;lt;&amp;gt; 0.
 MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.

&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this helps. Reward points if helpful.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Balaji&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 03 Apr 2008 14:27:47 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/check-if-program-is-currently-running/m-p/3623546#M872970</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-04-03T14:27:47Z</dc:date>
    </item>
  </channel>
</rss>

