<?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: program is not retrieving Spool Number. in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/program-is-not-retrieving-spool-number/m-p/8123098#M1618617</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Suhas,&lt;/P&gt;&lt;P&gt;                 &lt;SPAN __jive_emoticon_name="wink"&gt;&lt;/SPAN&gt; .. Yes. no need for WAIT inside WHILE and ENDWHILE. I just thought , the program will countineously try to read and check status of job untill it is finished or terminated.  So i thought , instead of checking status contineously , we could give some rest to the system like 30 seconds.. or..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Its just my thougth. Please correct me if im wrong.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Ravi.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 09 Sep 2011 06:57:37 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2011-09-09T06:57:37Z</dc:date>
    <item>
      <title>program is not retrieving Spool Number.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/program-is-not-retrieving-spool-number/m-p/8123093#M1618612</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Experts,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have written a program prog1. In prog1 I am submitting prog2 as a background Job using Job_open , Job_close FM.The requirement is I have to  read the spool number generated by prog2.Prog1 will start the job and read the spool number and do some processing on the data.So I have used &lt;STRONG&gt;start immediate&lt;/STRONG&gt; to start the prog2.But prog1 completes before prog2. So it is not able to read the spool number of prog2.Is there any way to keep the program prog1 in waiting state until the Spool  generates?&lt;/P&gt;&lt;P&gt;Please reply with any fruitful solution.Here the piece of code I have written in my program prog1.&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;CALL FUNCTION 'JOB_CLOSE'
    EXPORTING
     JOBCOUNT                          = g_jobcount
     JOBNAME                           = g_jobname  "prog2
     STRTIMMED                         = c_selected
   EXCEPTIONS
     CANT_START_IMMEDIATE              = 1
     INVALID_STARTDATE                 = 2
     JOBNAME_MISSING                   = 3
     JOB_CLOSE_FAILED                  = 4
     JOB_NOSTEPS                       = 5
     JOB_NOTEX                         = 6
     LOCK_FAILED                       = 7
     INVALID_TARGET                    = 8
     OTHERS                            = 9
            .
  IF SY-SUBRC &amp;lt;&amp;gt; 0.
    MESSAGE text-096 TYPE 'I'.
  ENDIF.
* Get Spool Number
  PERFORM f10000_get_spool_no ON COMMIT.
  COMMIT WORK AND WAIT.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;lt;Added code tags&amp;gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks in advance.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: Suhas Saha on Sep 9, 2011 11:12 AM&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 09 Sep 2011 04:40:02 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/program-is-not-retrieving-spool-number/m-p/8123093#M1618612</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2011-09-09T04:40:02Z</dc:date>
    </item>
    <item>
      <title>Re: program is not retrieving Spool Number.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/program-is-not-retrieving-spool-number/m-p/8123094#M1618613</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You can call the FM 'BP_JOB_READ' to get the spool details for the particular job.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;&lt;P&gt;But prog1 completes before prog2. So it is not able to read the spool number of prog2.Is there any way to keep the program prog1 in waiting state until the Spool generates?&lt;/P&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;The idea is to put the above FM call in a recursion viz., WHILE...ENDWHILE or DO...ENDDO. The Exit criteria should be based on JOB_READ_JOBHEAD-STATUS = 'F'(finished) or 'A'(aborted).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this is clear.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;BR,&lt;/P&gt;&lt;P&gt;Suhas&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 09 Sep 2011 06:07:30 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/program-is-not-retrieving-spool-number/m-p/8123094#M1618613</guid>
      <dc:creator>SuhaSaha</dc:creator>
      <dc:date>2011-09-09T06:07:30Z</dc:date>
    </item>
    <item>
      <title>Re: program is not retrieving Spool Number.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/program-is-not-retrieving-spool-number/m-p/8123095#M1618614</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Suhas,&lt;/P&gt;&lt;P&gt;Thanks for the reply.Can you tell me performance wise which is better while or Do?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Soma&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 09 Sep 2011 06:17:35 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/program-is-not-retrieving-spool-number/m-p/8123095#M1618614</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2011-09-09T06:17:35Z</dc:date>
    </item>
    <item>
      <title>Re: program is not retrieving Spool Number.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/program-is-not-retrieving-spool-number/m-p/8123096#M1618615</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;As said, you can use the FM inside WHILE...ENDWHILE.. with an WAIT UPTO 30 SECONDS statemnet..&lt;/P&gt;&lt;P&gt;hence FM willl check status of JOB for every 30 seconds or ( approximate time needed for execution of report)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Ravi.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 09 Sep 2011 06:25:53 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/program-is-not-retrieving-spool-number/m-p/8123096#M1618615</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2011-09-09T06:25:53Z</dc:date>
    </item>
    <item>
      <title>Re: program is not retrieving Spool Number.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/program-is-not-retrieving-spool-number/m-p/8123097#M1618616</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;PRE&gt;&lt;CODE&gt;&lt;P&gt;Can you tell me performance wise which is better while or Do?&lt;/P&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hello Soma,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;WHILE v/s DO - Afaik there are no performance implications to consider. Maybe the "performance" gurus might offer some light!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I generally prefer WHILE over DO because in the former you don't need to maintain any EXIT criteria, so he chances of an infinite loop is less &lt;SPAN __jive_emoticon_name="wink"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;@Ravi: If we use a WHILE iteration to check the job status WAIT is not required.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;BR,&lt;/P&gt;&lt;P&gt;Suhas&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 09 Sep 2011 06:34:30 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/program-is-not-retrieving-spool-number/m-p/8123097#M1618616</guid>
      <dc:creator>SuhaSaha</dc:creator>
      <dc:date>2011-09-09T06:34:30Z</dc:date>
    </item>
    <item>
      <title>Re: program is not retrieving Spool Number.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/program-is-not-retrieving-spool-number/m-p/8123098#M1618617</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Suhas,&lt;/P&gt;&lt;P&gt;                 &lt;SPAN __jive_emoticon_name="wink"&gt;&lt;/SPAN&gt; .. Yes. no need for WAIT inside WHILE and ENDWHILE. I just thought , the program will countineously try to read and check status of job untill it is finished or terminated.  So i thought , instead of checking status contineously , we could give some rest to the system like 30 seconds.. or..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Its just my thougth. Please correct me if im wrong.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Ravi.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 09 Sep 2011 06:57:37 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/program-is-not-retrieving-spool-number/m-p/8123098#M1618617</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2011-09-09T06:57:37Z</dc:date>
    </item>
    <item>
      <title>Re: program is not retrieving Spool Number.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/program-is-not-retrieving-spool-number/m-p/8123099#M1618618</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;PRE&gt;&lt;CODE&gt;&lt;P&gt;I generally prefer WHILE over DO because in the former you don't need to maintain any EXIT criteria, so he chances of an infinite loop is less &lt;SPAN __jive_emoticon_name="wink"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;There is an exit criteria for While, the logical expression immediately after WHILE constitutes the exit criteria.&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
WHILE LOG_EXP
ENDWHILE.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Where as in case of DO ENDDO, you would write it down with may be an IF Statement and EXIT command.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Afaik, there are no performance issues in either case, it is about usability. In case of a DO ENDO, there is atleast one iteration, where as in case of While Endwhile, it depends on the Logical expression.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So depending on the need you could choose either of them.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Yes. no need for WAIT inside WHILE and ENDWHILE. I just thought , the program will countineously try to read and check status of job untill it is finished or terminated. So i thought , instead of checking status contineously , we could give some rest to the system like 30 seconds.. or..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You don't need WAIT in either case DO or WHILE.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;There are certain implications involved when you use WAIT, like an implicit Database commit that it invokes etc...so be real careful when using them in order to not compromise the transaction data.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Chen&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 09 Sep 2011 08:17:50 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/program-is-not-retrieving-spool-number/m-p/8123099#M1618618</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2011-09-09T08:17:50Z</dc:date>
    </item>
    <item>
      <title>Re: program is not retrieving Spool Number.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/program-is-not-retrieving-spool-number/m-p/8123100#M1618619</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Experts,&lt;/P&gt;&lt;P&gt;                    @Suhas and @Chen thanks to lights on WAIT statement..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Ravi.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 09 Sep 2011 08:41:50 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/program-is-not-retrieving-spool-number/m-p/8123100#M1618619</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2011-09-09T08:41:50Z</dc:date>
    </item>
    <item>
      <title>Re: program is not retrieving Spool Number.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/program-is-not-retrieving-spool-number/m-p/8123101#M1618620</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Chen,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You didn't get my point &lt;SPAN __jive_emoticon_name="wink"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;&lt;P&gt;Where as in case of DO ENDDO, you would write it down with may be an IF Statement and EXIT command.&lt;/P&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Now that's exactly what i meant by EXIT criteria!! (See the EXIT in CAPS)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;BR,&lt;/P&gt;&lt;P&gt;Suhas&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;PS: I'm sorry if my reply caused confusion!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 09 Sep 2011 08:42:40 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/program-is-not-retrieving-spool-number/m-p/8123101#M1618620</guid>
      <dc:creator>SuhaSaha</dc:creator>
      <dc:date>2011-09-09T08:42:40Z</dc:date>
    </item>
  </channel>
</rss>

