<?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: Handling Open cursor logic while STARTING NEW TASK in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/handling-open-cursor-logic-while-starting-new-task/m-p/11236759#M1912680</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Raymond,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for your response.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Actually I was pointed out that using of WAIT TILL is issuing the implicit commit which is causing my OPEN CURSOR to go for short dump.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Alternatively Rudra suggested that I can check the counter of type STATIC inside the RECEIVE results method.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;However not sure on how can I ensure that all parallel calls are completed before I move on to next fetch using OPEN Cursor.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Kindly let me know your thoughts on handling the WAIT TILL while working wit OPEN Cursor logic.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 10 Sep 2015 10:33:31 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2015-09-10T10:33:31Z</dc:date>
    <item>
      <title>Handling Open cursor logic while STARTING NEW TASK</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/handling-open-cursor-logic-while-starting-new-task/m-p/11236752#M1912673</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Dear Experts,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Since I have to process huge number of records by selecting the stock information from MARD I am using the OPEN cursor logic to fetch the data from MARD table in packets of 10 K records. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have encapsulated by processing logic in a RFC enabled FM and do the parallel processing by means of STARTING NEW TASK addition to run the parallel threads so as to improve the performance of the program.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;However the 'STARTING NEW TASK' issues a IMPLICIT COMMIT due to which the CURSOR opened earlier by OPEN CURSOR WITH HOLD is getting closed and when the program encounters the FETCH NEXT CURSOR in subsequent iteration the program dumps saying the CURSOR is already closed.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Kindly provide your valuable inputs on how can I keep the CURSOR open at the same time run the parallel threads as well.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Srini&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 04 Sep 2015 08:26:18 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/handling-open-cursor-logic-while-starting-new-task/m-p/11236752#M1912673</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2015-09-04T08:26:18Z</dc:date>
    </item>
    <item>
      <title>Re: Handling Open cursor logic while STARTING NEW TASK</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/handling-open-cursor-logic-while-starting-new-task/m-p/11236753#M1912674</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;Are you using any WAIT UNTIL command in the RECEIVE FM/Method?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;R&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 04 Sep 2015 09:13:31 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/handling-open-cursor-logic-while-starting-new-task/m-p/11236753#M1912674</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2015-09-04T09:13:31Z</dc:date>
    </item>
    <item>
      <title>Re: Handling Open cursor logic while STARTING NEW TASK</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/handling-open-cursor-logic-while-starting-new-task/m-p/11236754#M1912675</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Yes I am using the WAIT UNTIL command right after the RFC FM call but not within FORM routine where I RECEIVE RESULTS from RFC FM.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have to collate the information from all the parallel threads and update a custom table once the threads are processed.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 04 Sep 2015 10:01:39 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/handling-open-cursor-logic-while-starting-new-task/m-p/11236754#M1912675</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2015-09-04T10:01:39Z</dc:date>
    </item>
    <item>
      <title>Re: Handling Open cursor logic while STARTING NEW TASK</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/handling-open-cursor-logic-while-starting-new-task/m-p/11236755#M1912676</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You call to FM does not issue any implicit commit. Rather this command does. I think that is forcing the Cursor to closed prematurely.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG class="migrated-image" src="https://community.sap.com/legacyfs/online/storage/attachments/storage/7/jiveimages/783728" width="450" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You can keep updating your custom table. Not sure why you have to wait until all the process are finished. This way the "commit" problem should not be there.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;R&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 04 Sep 2015 10:06:14 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/handling-open-cursor-logic-while-starting-new-task/m-p/11236755#M1912676</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2015-09-04T10:06:14Z</dc:date>
    </item>
    <item>
      <title>Re: Handling Open cursor logic while STARTING NEW TASK</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/handling-open-cursor-logic-while-starting-new-task/m-p/11236756#M1912677</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Rudra,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks a lot for your inputs.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;One other reason for using the WAIT UNTIL is to check if all the parallel thread are complete before fetching the next set of records from MARD for processing as the custom table which I am updating after parallel processing steps also acts like a lookup in subsequent iterations to avoid processing the Material/Plant where were already processed in previous iterations.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Could you please suggest if there is any other better way to check if all the threads are completed or not ?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Additionally I have used a WAIT of 5 seconds to get the available work processes if none of them are free then the program will maximum WAIT for 5 seconds and again check for the free work processes.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Srini&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 04 Sep 2015 10:30:06 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/handling-open-cursor-logic-while-starting-new-task/m-p/11236756#M1912677</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2015-09-04T10:30:06Z</dc:date>
    </item>
    <item>
      <title>Re: Handling Open cursor logic while STARTING NEW TASK</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/handling-open-cursor-logic-while-starting-new-task/m-p/11236757#M1912678</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You could put a count variable of no of parallel calls you are making and in receive routine check that back to know all the calls have been made or not by setting a different variable ( Static ) or use GET/SET technique to increment each time receive routine is called and comparing these two variables.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 04 Sep 2015 10:51:22 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/handling-open-cursor-logic-while-starting-new-task/m-p/11236757#M1912678</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2015-09-04T10:51:22Z</dc:date>
    </item>
    <item>
      <title>Re: Handling Open cursor logic while STARTING NEW TASK</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/handling-open-cursor-logic-while-starting-new-task/m-p/11236758#M1912679</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Some tricks, but use the search tool, Cursor and Parallel executions are FAQ.&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;Use option &lt;SPAN class="L0S52"&gt;WITH HOLD to protect cursor from implicit db commit&lt;/SPAN&gt;&lt;/LI&gt;&lt;LI&gt;&lt;SPAN class="L0S52"&gt;Increment a counter at each execution of CALL STARTING NEW TASK, &lt;/SPAN&gt;&lt;/LI&gt;&lt;LI&gt;&lt;SPAN class="L0S52"&gt;Add a &lt;SPAN class="qtext"&gt;CALLING meth ON END OF TASK to RECEIVE the result&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/LI&gt;&lt;LI&gt;&lt;SPAN class="L0S52"&gt;Decrement the counter in the the END OF TASK method&lt;/SPAN&gt;&lt;/LI&gt;&lt;LI&gt;&lt;SPAN class="L0S52"&gt;At end use a WAIT til counter is initial.&lt;/SPAN&gt;&lt;/LI&gt;&lt;LI&gt;&lt;SPAN class="L0S52"&gt;Use a FM SPBT_INITIALIZE to get maximum and currently available number of process (use a &lt;SPAN class="L0S52"&gt;group name defined &lt;SPAN class="L0S52"&gt;with &lt;/SPAN&gt;RZ12) if none use a WAIT til counter is reduced&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/LI&gt;&lt;LI&gt;&lt;SPAN class="L0S52"&gt;&lt;SPAN class="L0S52"&gt;Use the search tool,&amp;nbsp; there are already discussions and document on this subject.&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;SPAN class="L0S52"&gt;&lt;SPAN class="L0S52"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="L0S52"&gt;&lt;SPAN class="L0S52"&gt;Regards,&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="L0S52"&gt;&lt;SPAN class="L0S52"&gt;Raymond&lt;BR /&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 04 Sep 2015 12:20:12 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/handling-open-cursor-logic-while-starting-new-task/m-p/11236758#M1912679</guid>
      <dc:creator>RaymondGiuseppi</dc:creator>
      <dc:date>2015-09-04T12:20:12Z</dc:date>
    </item>
    <item>
      <title>Re: Handling Open cursor logic while STARTING NEW TASK</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/handling-open-cursor-logic-while-starting-new-task/m-p/11236759#M1912680</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Raymond,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for your response.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Actually I was pointed out that using of WAIT TILL is issuing the implicit commit which is causing my OPEN CURSOR to go for short dump.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Alternatively Rudra suggested that I can check the counter of type STATIC inside the RECEIVE results method.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;However not sure on how can I ensure that all parallel calls are completed before I move on to next fetch using OPEN Cursor.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Kindly let me know your thoughts on handling the WAIT TILL while working wit OPEN Cursor logic.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 10 Sep 2015 10:33:31 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/handling-open-cursor-logic-while-starting-new-task/m-p/11236759#M1912680</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2015-09-10T10:33:31Z</dc:date>
    </item>
    <item>
      <title>Re: Handling Open cursor logic while STARTING NEW TASK</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/handling-open-cursor-logic-while-starting-new-task/m-p/11236760#M1912681</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Srini,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Would you mind if i ask you to separate the task of getting the data and processing it.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1. first fetch all the day into internal table (it can be using the Cursor) and fill everything in internal table until cursor finishes fetching data.&lt;/P&gt;&lt;P&gt;2. next, take records from your internal table like 10K records each time and then call the FM in new task.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 10 Sep 2015 11:09:21 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/handling-open-cursor-logic-while-starting-new-task/m-p/11236760#M1912681</guid>
      <dc:creator>former_member183073</dc:creator>
      <dc:date>2015-09-10T11:09:21Z</dc:date>
    </item>
    <item>
      <title>Re: Handling Open cursor logic while STARTING NEW TASK</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/handling-open-cursor-logic-while-starting-new-task/m-p/11236761#M1912682</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Did you use the option &lt;A class="blue" href="http://help.sap.com/abapdocu_740/en/abapopen_cursor.htm#%21ABAP_ONE_ADD@1@"&gt;&lt;SPAN class="qtext"&gt;WITH HOLD&lt;/SPAN&gt;&lt;/A&gt; which protects cursor against db commit as I suggested?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 10 Sep 2015 11:47:01 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/handling-open-cursor-logic-while-starting-new-task/m-p/11236761#M1912682</guid>
      <dc:creator>RaymondGiuseppi</dc:creator>
      <dc:date>2015-09-10T11:47:01Z</dc:date>
    </item>
    <item>
      <title>Re: Handling Open cursor logic while STARTING NEW TASK</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/handling-open-cursor-logic-while-starting-new-task/m-p/11236762#M1912683</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Syed,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for your reply.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Actually the internal table data can range from 2 - 4 Million. So the internal table might exceed the size limit if i try to fill entire data at one shot. Correct me if i m wrong.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 10 Sep 2015 15:20:20 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/handling-open-cursor-logic-while-starting-new-task/m-p/11236762#M1912683</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2015-09-10T15:20:20Z</dc:date>
    </item>
    <item>
      <title>Re: Handling Open cursor logic while STARTING NEW TASK</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/handling-open-cursor-logic-while-starting-new-task/m-p/11236763#M1912684</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Yes I m already having the WITH HOLD addition to OPEN CURSOR. But still the WAIT TILL is giving problem while i do the parallel processing.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 10 Sep 2015 15:21:29 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/handling-open-cursor-logic-while-starting-new-task/m-p/11236763#M1912684</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2015-09-10T15:21:29Z</dc:date>
    </item>
    <item>
      <title>Re: Handling Open cursor logic while STARTING NEW TASK</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/handling-open-cursor-logic-while-starting-new-task/m-p/11236764#M1912685</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN class="L0S31"&gt;Try in this way.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="L0S31"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="L0S31"&gt;This will call the FM n times and count it until the data is over in Cursor and the "&lt;SPAN style="font-size: 13.3333px;"&gt;count&lt;/SPAN&gt;" will decrease after the FM finishes execution.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="L0S31"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="L0S31"&gt;The wait will start only after calling the FM for all data, so no chance of Cursor getting closed.&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="L0S31"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="L0S31"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="L0S52"&gt;REPORT&amp;nbsp; &lt;/SPAN&gt;zp_test.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; &lt;SPAN class="L0S52"&gt;DATA: &lt;/SPAN&gt;l_v_count &lt;SPAN class="L0S52"&gt;TYPE &lt;/SPAN&gt;&lt;SPAN class="L0S52"&gt;i.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt; &lt;SPAN class="L0S52"&gt;PERFORM &lt;/SPAN&gt;fetch_data.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; &lt;SPAN class="L0S31"&gt;*&amp;amp;---------------------------------------------------------------------*&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt; &lt;SPAN class="L0S31"&gt;*&amp;amp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Form&amp;nbsp; FETCH_DATA&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt; &lt;SPAN class="L0S31"&gt;*&amp;amp;---------------------------------------------------------------------*&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt; &lt;SPAN class="L0S31"&gt;*&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; text&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt; &lt;SPAN class="L0S31"&gt;*----------------------------------------------------------------------*&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt; &lt;SPAN class="L0S31"&gt;*&amp;nbsp; --&amp;gt;&amp;nbsp; p1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; text&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt; &lt;SPAN class="L0S31"&gt;*&amp;nbsp; &amp;lt;--&amp;nbsp; p2&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; text&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt; &lt;SPAN class="L0S31"&gt;*----------------------------------------------------------------------*&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt; &lt;SPAN class="L0S52"&gt;FORM &lt;/SPAN&gt;fetch_data .&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; &lt;SPAN class="L0S52"&gt;DATA: &lt;/SPAN&gt;l_i_vbak &lt;SPAN class="L0S52"&gt;TYPE &lt;/SPAN&gt;&lt;SPAN class="L0S52"&gt;TABLE &lt;/SPAN&gt;&lt;SPAN class="L0S52"&gt;OF &lt;/SPAN&gt;vbak,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; l_v_flag &lt;SPAN class="L0S52"&gt;TYPE &lt;/SPAN&gt;flag,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; l_v_task &lt;SPAN class="L0S52"&gt;TYPE &lt;/SPAN&gt;string,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; l_v_index &lt;SPAN class="L0S52"&gt;TYPE &lt;/SPAN&gt;string.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; &lt;SPAN class="L0S52"&gt;STATICS: &lt;/SPAN&gt;s_cursor &lt;SPAN class="L0S52"&gt;TYPE &lt;/SPAN&gt;&lt;SPAN class="L0S52"&gt;cursor.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; &lt;SPAN class="L0S52"&gt;OPEN &lt;/SPAN&gt;&lt;SPAN class="L0S52"&gt;CURSOR &lt;/SPAN&gt;&lt;SPAN class="L0S52"&gt;WITH &lt;/SPAN&gt;HOLD s_cursor &lt;SPAN class="L0S52"&gt;FOR&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN class="L0S52"&gt;SELECT &lt;/SPAN&gt;* &lt;SPAN class="L0S52"&gt;FROM &lt;/SPAN&gt;vbak.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; &lt;SPAN class="L0S52"&gt;WHILE &lt;/SPAN&gt;l_v_flag &lt;SPAN class="L0S52"&gt;IS &lt;/SPAN&gt;&lt;SPAN class="L0S52"&gt;INITIAL.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; l_v_index &lt;SPAN class="L0S55"&gt;= &lt;/SPAN&gt;sy&lt;SPAN class="L0S70"&gt;-&lt;/SPAN&gt;&lt;SPAN class="L0S52"&gt;index.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN class="L0S52"&gt;FETCH &lt;/SPAN&gt;&lt;SPAN class="L0S52"&gt;NEXT &lt;/SPAN&gt;&lt;SPAN class="L0S52"&gt;CURSOR &lt;/SPAN&gt;s_cursor&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN class="L0S52"&gt;APPENDING &lt;/SPAN&gt;CORRESPONDING &lt;SPAN class="L0S52"&gt;FIELDS&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN class="L0S52"&gt;OF &lt;/SPAN&gt;&lt;SPAN class="L0S52"&gt;TABLE &lt;/SPAN&gt;l_i_vbak&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; PACKAGE &lt;SPAN class="L0S52"&gt;SIZE &lt;/SPAN&gt;&lt;SPAN class="L0S32"&gt;10.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN class="L0S52"&gt;IF &lt;/SPAN&gt;sy&lt;SPAN class="L0S70"&gt;-&lt;/SPAN&gt;subrc &lt;SPAN class="L0S52"&gt;IS &lt;/SPAN&gt;&lt;SPAN class="L0S52"&gt;INITIAL.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; l_v_count &lt;SPAN class="L0S55"&gt;= &lt;/SPAN&gt;l_v_count + &lt;SPAN class="L0S32"&gt;1.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN class="L0S52"&gt;CONCATENATE &lt;/SPAN&gt;&lt;SPAN class="L0S33"&gt;'TASK' &lt;/SPAN&gt;l_v_index &lt;SPAN class="L0S52"&gt;INTO &lt;/SPAN&gt;l_v_task.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN class="L0S52"&gt;CALL &lt;/SPAN&gt;&lt;SPAN class="L0S52"&gt;FUNCTION &lt;/SPAN&gt;&lt;SPAN class="L0S33"&gt;'ZP_TEST' &lt;/SPAN&gt;&lt;SPAN class="L0S52"&gt;STARTING &lt;/SPAN&gt;&lt;SPAN class="L0S52"&gt;NEW &lt;/SPAN&gt;&lt;SPAN class="L0S52"&gt;TASK &lt;/SPAN&gt;l_v_task&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; DESTINATION &lt;SPAN class="L0S33"&gt;'NONE'&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; PERFORMING &lt;SPAN class="L0S52"&gt;count &lt;/SPAN&gt;&lt;SPAN class="L0S52"&gt;ON &lt;/SPAN&gt;&lt;SPAN class="L0S52"&gt;END &lt;/SPAN&gt;&lt;SPAN class="L0S52"&gt;OF &lt;/SPAN&gt;&lt;SPAN class="L0S52"&gt;TASK.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN class="L0S52"&gt;refresh &lt;/SPAN&gt;l_i_vbak.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN class="L0S52"&gt;ELSE.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN class="L0S52"&gt;WAIT &lt;/SPAN&gt;UNTIL l_v_count &lt;SPAN class="L0S52"&gt;EQ &lt;/SPAN&gt;&lt;SPAN class="L0S32"&gt;0.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; l_v_flag &lt;SPAN class="L0S55"&gt;= &lt;/SPAN&gt;&lt;SPAN class="L0S33"&gt;'X'.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN class="L0S52"&gt;ENDIF.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; &lt;SPAN class="L0S52"&gt;ENDWHILE.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; &lt;SPAN class="L0S52"&gt;ENDFORM.&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN class="L0S31"&gt;" FETCH_DATA&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt; &lt;SPAN class="L0S31"&gt;*&amp;amp;---------------------------------------------------------------------*&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt; &lt;SPAN class="L0S31"&gt;*&amp;amp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Form&amp;nbsp; COUNT&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt; &lt;SPAN class="L0S31"&gt;*&amp;amp;---------------------------------------------------------------------*&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt; &lt;SPAN class="L0S31"&gt;*&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; text&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt; &lt;SPAN class="L0S31"&gt;*----------------------------------------------------------------------*&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt; &lt;SPAN class="L0S31"&gt;*&amp;nbsp; --&amp;gt;&amp;nbsp; p1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; text&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt; &lt;SPAN class="L0S31"&gt;*&amp;nbsp; &amp;lt;--&amp;nbsp; p2&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; text&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt; &lt;SPAN class="L0S31"&gt;*----------------------------------------------------------------------*&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt; &lt;SPAN class="L0S52"&gt;FORM &lt;/SPAN&gt;&lt;SPAN class="L0S52"&gt;count &lt;/SPAN&gt;&lt;SPAN class="L0S52"&gt;USING &lt;/SPAN&gt;p_task.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; l_v_count &lt;SPAN class="L0S55"&gt;= &lt;/SPAN&gt;l_v_count &lt;SPAN class="L0S70"&gt;- &lt;/SPAN&gt;&lt;SPAN class="L0S32"&gt;1.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt; &lt;SPAN class="L0S52"&gt;ENDFORM.&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN class="L0S31"&gt;" COUNT&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 11 Sep 2015 12:04:24 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/handling-open-cursor-logic-while-starting-new-task/m-p/11236764#M1912685</guid>
      <dc:creator>former_member183073</dc:creator>
      <dc:date>2015-09-11T12:04:24Z</dc:date>
    </item>
    <item>
      <title>Re: Handling Open cursor logic while STARTING NEW TASK</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/handling-open-cursor-logic-while-starting-new-task/m-p/11236765#M1912686</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;But you may trigger a RESOURCE_FAILURE error if no process are available, so I would suggest a&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
&lt;P style="font-family: courier; color: black;"&gt;&lt;SPAN style="color: #0000ff;"&gt;IF&lt;/SPAN&gt; nb_running &lt;SPAN style="color: #0000ff;"&gt;LT&lt;/SPAN&gt; max_allowed&lt;SPAN style="color: #800080;"&gt;.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="font-family: courier; color: black;"&gt;&amp;nbsp; &lt;SPAN style="color: #0000ff;"&gt;CALL&lt;/SPAN&gt; &lt;SPAN style="color: #0000ff;"&gt;FUNCTION&lt;/SPAN&gt; z_xxx &lt;SPAN style="color: #0000ff;"&gt;STARTING NEW TASK..&lt;/SPAN&gt;&lt;SPAN style="color: #800080;"&gt;.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="font-family: courier; color: black;"&gt;&amp;nbsp; &lt;SPAN style="color: #0000ff;"&gt;ADD&lt;/SPAN&gt; &lt;SPAN style="color: #3399ff;"&gt;1&lt;/SPAN&gt; &lt;SPAN style="color: #0000ff;"&gt;TO&lt;/SPAN&gt; nb_running&lt;SPAN style="color: #800080;"&gt;.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="font-family: courier; color: black;"&gt;&lt;SPAN style="color: #0000ff;"&gt;ELSE&lt;/SPAN&gt;&lt;SPAN style="color: #800080;"&gt;.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="font-family: courier; color: black;"&gt;&amp;nbsp; &lt;SPAN style="color: #0000ff;"&gt;CALL&lt;/SPAN&gt; &lt;SPAN style="color: #0000ff;"&gt;FUNCTION&lt;/SPAN&gt; z_xxx&lt;SPAN style="color: #800080;"&gt;...&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="font-family: courier; color: black;"&gt;&lt;SPAN style="color: #0000ff;"&gt;ENDIF&lt;/SPAN&gt;&lt;SPAN style="color: #800080;"&gt;.&lt;/SPAN&gt;&lt;/P&gt;

&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;So WAIT statement only executed when cursor closed.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Raymond&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 11 Sep 2015 12:18:20 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/handling-open-cursor-logic-while-starting-new-task/m-p/11236765#M1912686</guid>
      <dc:creator>RaymondGiuseppi</dc:creator>
      <dc:date>2015-09-11T12:18:20Z</dc:date>
    </item>
  </channel>
</rss>

