<?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: Deadlock with Enqueue Module in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/deadlock-with-enqueue-module/m-p/1103916#M104202</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;So instead of dumping, have the program complete with a message "Tasks locked - try again later".&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Rob&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sat, 05 Nov 2005 04:05:11 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2005-11-05T04:05:11Z</dc:date>
    <item>
      <title>Deadlock with Enqueue Module</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/deadlock-with-enqueue-module/m-p/1103911#M104197</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;&lt;/P&gt;&lt;P&gt;We are implemententing a standard-cum-customized solution for Task and Resource Management in selecting tasks.  The process here is selecting the best tasks available for the user and locking these tasks using ENQUEUE_ETLTKPLE for task pool table (LTKPL). &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The above process of picking the tasks is initiated by a RF device and in our integration testing we realized that if 3/4 people sign in and try to perform the tasks, the system enters in a deadlock in trying to get the lock and dumps.  The following the code which enqueues a task:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;....Lock Task........................................................&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;  CALL FUNCTION 'ENQUEUE_ETLTKPLE'&lt;/P&gt;&lt;P&gt;    EXPORTING&lt;/P&gt;&lt;P&gt;      locat          = i_locat&lt;/P&gt;&lt;P&gt;      taski          = i_taski&lt;/P&gt;&lt;P&gt;      &lt;U&gt;collect       = trmgc&lt;/U&gt;x&lt;/P&gt;&lt;P&gt;      _scope         = '3'&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;&lt;/P&gt;&lt;P&gt;  IF sy-subrc EQ 0.&lt;/P&gt;&lt;P&gt;    CALL FUNCTION 'FLUSH_ENQUEUE'&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;&lt;/P&gt;&lt;P&gt;    e_subrc = sy-subrc.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    IF sy-subrc &amp;lt;&amp;gt; 0.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;    Empty container&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;      CALL FUNCTION 'RESET_ENQUEUE'.&lt;/P&gt;&lt;P&gt;    ENDIF.&lt;/P&gt;&lt;P&gt;  ENDIF.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any help to resolve the above would be great appreciated.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;Sunil Achyut&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 04 Feb 2024 01:39:42 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/deadlock-with-enqueue-module/m-p/1103911#M104197</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2024-02-04T01:39:42Z</dc:date>
    </item>
    <item>
      <title>Re: Deadlock with Enqueue Module</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/deadlock-with-enqueue-module/m-p/1103912#M104198</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Normally locks are in place only for the time that it takes to do the updates:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Lock(s)&lt;/P&gt;&lt;P&gt;Update(s)&lt;/P&gt;&lt;P&gt;Unlock(s)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any longer and you will run into the problem you are having.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Rob&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 04 Nov 2005 22:16:08 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/deadlock-with-enqueue-module/m-p/1103912#M104198</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2005-11-04T22:16:08Z</dc:date>
    </item>
    <item>
      <title>Re: Deadlock with Enqueue Module</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/deadlock-with-enqueue-module/m-p/1103913#M104199</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Rob&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Is there any other way for this, I am trying to prevent a single task being given to multiple users.  Since we are kind of customizing (in BADI &amp;amp; Zing out a FM) and using standard, am not sure if there is a way where I can prevent multiple RFs getting the same tasks other than locking them through Enqueue FM.  &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any hints would be great helpful.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;Sunil Achyut&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 04 Nov 2005 22:41:19 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/deadlock-with-enqueue-module/m-p/1103913#M104199</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2005-11-04T22:41:19Z</dc:date>
    </item>
    <item>
      <title>Re: Deadlock with Enqueue Module</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/deadlock-with-enqueue-module/m-p/1103914#M104200</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;How long is the task locked for?  Can you wait till it is released? There is a parameter on the ENQUEUE function module _WAIT, set it to "X" to wait.  It will wait for a time specified system wide for the lock to be released, this may prevent the dumping.  If the lock is held too long, then this will probably not work for you.&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>Fri, 04 Nov 2005 23:42:19 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/deadlock-with-enqueue-module/m-p/1103914#M104200</guid>
      <dc:creator>RichHeilman</dc:creator>
      <dc:date>2005-11-04T23:42:19Z</dc:date>
    </item>
    <item>
      <title>Re: Deadlock with Enqueue Module</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/deadlock-with-enqueue-module/m-p/1103915#M104201</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Rich&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In my case if a task is locked, it has to be skipped.  In other words, the program shouldnt wait for it.  The process is if a resource is given certain tasks, he normally completes them and if two resource sign on and request for tasks at quick succession thats when the deadlock is occuring.  &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Is there a way that if a task is locked, its skipped rather than waiting for it to be released.  Is there another way to lock an task without causing the deadlock, if there please suggest.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;Sunil Achyut&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 05 Nov 2005 01:00:10 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/deadlock-with-enqueue-module/m-p/1103915#M104201</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2005-11-05T01:00:10Z</dc:date>
    </item>
    <item>
      <title>Re: Deadlock with Enqueue Module</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/deadlock-with-enqueue-module/m-p/1103916#M104202</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;So instead of dumping, have the program complete with a message "Tasks locked - try again later".&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Rob&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 05 Nov 2005 04:05:11 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/deadlock-with-enqueue-module/m-p/1103916#M104202</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2005-11-05T04:05:11Z</dc:date>
    </item>
    <item>
      <title>Re: Deadlock with Enqueue Module</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/deadlock-with-enqueue-module/m-p/1103917#M104203</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I agree with Rob,  you should be able to check sy-subrc = 1, then give a message.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Also, I'm not sure what this is all about.  Do you need it?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;IF sy-subrc EQ 0.
CALL FUNCTION 'FLUSH_ENQUEUE'
EXCEPTIONS
foreign_lock = 1
system_failure = 2
OTHERS = 3.

e_subrc = sy-subrc.

IF sy-subrc &amp;lt;&amp;gt; 0.
* Empty container
CALL FUNCTION 'RESET_ENQUEUE'.
ENDIF.
ENDIF.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Rich Heilman&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Message was edited by: Rich Heilman&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 05 Nov 2005 11:59:24 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/deadlock-with-enqueue-module/m-p/1103917#M104203</guid>
      <dc:creator>RichHeilman</dc:creator>
      <dc:date>2005-11-05T11:59:24Z</dc:date>
    </item>
    <item>
      <title>Re: Deadlock with Enqueue Module</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/deadlock-with-enqueue-module/m-p/1103918#M104204</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Rob Rich&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for your input.  Rob even I would have expected to return sy-subrc &amp;lt;&amp;gt; 0, but in my case once it goes in the enqueue FM, the control never comes back to my program and the dump happens because of max time for a script exeuction.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Rich it was my understanding that 'FLUSH_ENQUEUE' send the local locks to the server and if the server already has a lock for the current record the 'RESET_ENQUEUE' deletes all the locks of the local container.  I wouldnt have known this if I hadnt debugged the SAP standard code, and I realized this was the right way and had to put the same in my locking logic.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;After some research I found out that, before trying to lock I have to first check the locks in SM12 by calling the FM 'ENQUEUE_READ' and if someone else holds the lock skip the locking logic and process another task.  Am I right in my assumption, and would appreciate any suggestion you might have.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;Sunil Achyut&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 05 Nov 2005 14:06:01 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/deadlock-with-enqueue-module/m-p/1103918#M104204</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2005-11-05T14:06:01Z</dc:date>
    </item>
    <item>
      <title>Re: Deadlock with Enqueue Module</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/deadlock-with-enqueue-module/m-p/1103919#M104205</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Ok, interesting,  I never really had a requirement quite like yours,  I have always used the &lt;U&gt;WAIT parameter so that it would wait for the release of the lock, in my case it was ok to wait for a second or two.  Give it a try with the ENQUEUE&lt;/U&gt;READ.  That makes sense to me.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Even on a Saturday, I learned something new.  Thanks for that.&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>Sat, 05 Nov 2005 14:18:17 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/deadlock-with-enqueue-module/m-p/1103919#M104205</guid>
      <dc:creator>RichHeilman</dc:creator>
      <dc:date>2005-11-05T14:18:17Z</dc:date>
    </item>
  </channel>
</rss>

