<?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: Issue with Program lock in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/issue-with-program-lock/m-p/1801612#M344081</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;I would suggest the following as an alternate&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1) to look for the tables TBTCO and TBTCP which holds all job names and it's status.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2) Or there are lot of function modules to check the status of the batch job, refer the function group BDL3 (sample: BDL_CHECK_FOR_RUNNING_BATCHJOB).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope, it helps.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;Viswa&lt;/P&gt;&lt;P&gt;(Assign points if helpful)&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 11 Dec 2006 22:45:43 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2006-12-11T22:45:43Z</dc:date>
    <item>
      <title>Issue with Program lock</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/issue-with-program-lock/m-p/1801610#M344079</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have a requirement to lock the Program if it is already running with the same variant. My program is scheduled to run every 5 minutes for each variant. So if the program finds the Previous Job still under execution then it should throw an error saying 'The program is still Running with the same Variant xxxx". &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am using the Lock Object 'ESVARIANT' to the lock the Program using the same &lt;/P&gt;&lt;P&gt;variant.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  CALL FUNCTION 'ENQUEUE_ESVARIANT'&lt;/P&gt;&lt;P&gt;    EXPORTING&lt;/P&gt;&lt;P&gt;      MODE_VARI      = C_E                      "E&lt;/P&gt;&lt;P&gt;      MANDT             = SY-MANDT&lt;/P&gt;&lt;P&gt;      RELID               = C_RELID                  "VA&lt;/P&gt;&lt;P&gt;      REPORT           = SY-CPROG&lt;/P&gt;&lt;P&gt;      VARIANT          = SY-SLSET&lt;/P&gt;&lt;P&gt;    EXCEPTIONS&lt;/P&gt;&lt;P&gt;      FOREIGN_LOCK   = 1&lt;/P&gt;&lt;P&gt;      SYSTEM_FAILURE = 2&lt;/P&gt;&lt;P&gt;      OTHERS         = 3.&lt;/P&gt;&lt;P&gt;  IF SY-SUBRC &amp;lt;&amp;gt; 0.&lt;/P&gt;&lt;P&gt;    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO&lt;/P&gt;&lt;P&gt;            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.&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;This lock object works fine most of the times but for some reason it fails sometimes, i.e It does not get locked even if it finds a Job executing with the same variant?. It is not reliable using this Lock object 'ESVARIANT'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Can any of you suggest me any other solution for this? . &lt;/P&gt;&lt;P&gt;Any solutions is appreciated and rewarded.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;Sekhar&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Message was edited by: &lt;/P&gt;&lt;P&gt;        Nagasekhar Reddy.K&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Message was edited by: &lt;/P&gt;&lt;P&gt;        Nagasekhar Reddy.K&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 11 Dec 2006 15:01:55 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/issue-with-program-lock/m-p/1801610#M344079</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-12-11T15:01:55Z</dc:date>
    </item>
    <item>
      <title>Re: Issue with Program lock</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/issue-with-program-lock/m-p/1801611#M344080</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I'm wondering if you shouldn't be passing variables instead of system fields here.  At least the sy-cprog may be a problem.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;data: v_cprog type sy-cprog,
        v_slset type sy-slset.

v_cprog = sy-cprog.
v_slset  = sy-slset.



CALL FUNCTION 'ENQUEUE_ESVARIANT'
EXPORTING
MODE_VARI = C_E "E
MANDT = SY-MANDT
RELID = C_RELID "VA
REPORT = v_CPROG
VARIANT = v_SLSET
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;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Rich Heilman&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 11 Dec 2006 18:18:26 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/issue-with-program-lock/m-p/1801611#M344080</guid>
      <dc:creator>RichHeilman</dc:creator>
      <dc:date>2006-12-11T18:18:26Z</dc:date>
    </item>
    <item>
      <title>Re: Issue with Program lock</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/issue-with-program-lock/m-p/1801612#M344081</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;I would suggest the following as an alternate&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1) to look for the tables TBTCO and TBTCP which holds all job names and it's status.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2) Or there are lot of function modules to check the status of the batch job, refer the function group BDL3 (sample: BDL_CHECK_FOR_RUNNING_BATCHJOB).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope, it helps.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;Viswa&lt;/P&gt;&lt;P&gt;(Assign points if helpful)&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 11 Dec 2006 22:45:43 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/issue-with-program-lock/m-p/1801612#M344081</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-12-11T22:45:43Z</dc:date>
    </item>
    <item>
      <title>Re: Issue with Program lock</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/issue-with-program-lock/m-p/1801613#M344082</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;In addition, check this function module also BP_JOB_SELECT_SM37C.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;Viswa&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 11 Dec 2006 23:28:09 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/issue-with-program-lock/m-p/1801613#M344082</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-12-11T23:28:09Z</dc:date>
    </item>
    <item>
      <title>Re: Issue with Program lock</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/issue-with-program-lock/m-p/1801614#M344083</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Use FM TH_WPINFO.&lt;/P&gt;&lt;P&gt;It will returns the work-processes of the application server, distinguished by Program name, user, etc...&lt;/P&gt;&lt;P&gt;Loop at the returning table searching for your program, and if found do whatever you need in the code.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this helps,&lt;/P&gt;&lt;P&gt;Roby.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 12 Dec 2006 09:51:11 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/issue-with-program-lock/m-p/1801614#M344083</guid>
      <dc:creator>former_member199581</dc:creator>
      <dc:date>2006-12-12T09:51:11Z</dc:date>
    </item>
  </channel>
</rss>

