<?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: Submit and Wait ? in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/submit-and-wait/m-p/3787559#M911211</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;nobody knows how long a certain report will last, so wait up to X seconds can work one day and give problems the other day.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Than it would be better to use FM SHOW_JOBSTATE and see if report is finished. But you have to do this a DO - ENDDO / WHILE - ENDWHILE.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 23 Apr 2008 19:25:49 GMT</pubDate>
    <dc:creator>Sm1tje</dc:creator>
    <dc:date>2008-04-23T19:25:49Z</dc:date>
    <item>
      <title>Submit and Wait ?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/submit-and-wait/m-p/3787556#M911208</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 am using JOB_OPEN , SUBMIT and JOB_CLOSE for program to create a spool.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My problem is after the JOB_CLOSE i am calling another report  to send output of first report from the spool.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My problem is after submitting the program report1 system calls the job_close and tried to send report1 output as mail. But still the submit report1 is still running . &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My question how to use submit statement wait for submit report1 is finished and then only call JOB_CLOSE.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
    call function 'JOB_OPEN'
      exporting
        jobname          = v_jobname
      importing
        jobcount         = v_jobcount
      exceptions
        cant_create_job  = 01
        invalid_job_data = 02
        jobname_missing  = 03
        others           = 99.

    submit report1
                    via job v_jobname
                    number v_jobcount
                    to sap-spool without spool dynpro
                    spool parameters wa_params
                    and return.

    call function 'JOB_CLOSE'
      exporting
        jobcount          = v_jobcount
        jobname           = v_jobname
        strtimmed         = 'X'
      importing
        job_was_released  = v_job_released
      exceptions
        invalid_startdate = 01
        jobname_missing   = 02
        job_close_failed  = 03
        job_nosteps       = 04
        job_notex         = 05
        lock_failed       = 06
        others            = 99.

  submit report2 with spool = v_spool. " For mailing

&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Sa_R&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 23 Apr 2008 18:56:48 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/submit-and-wait/m-p/3787556#M911208</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-04-23T18:56:48Z</dc:date>
    </item>
    <item>
      <title>Re: Submit and Wait ?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/submit-and-wait/m-p/3787557#M911209</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;One option would be to add job steps using the FM JOB_SUBMIT. This way you can say that the next step in the job should wait for the previous to end before continuing.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 23 Apr 2008 19:05:18 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/submit-and-wait/m-p/3787557#M911209</guid>
      <dc:creator>Sm1tje</dc:creator>
      <dc:date>2008-04-23T19:05:18Z</dc:date>
    </item>
    <item>
      <title>Re: Submit and Wait ?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/submit-and-wait/m-p/3787558#M911210</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;After submit can u try &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;WAIT UP TO 2 SECONDS.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;and see what happens.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 23 Apr 2008 19:06:05 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/submit-and-wait/m-p/3787558#M911210</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-04-23T19:06:05Z</dc:date>
    </item>
    <item>
      <title>Re: Submit and Wait ?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/submit-and-wait/m-p/3787559#M911211</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;nobody knows how long a certain report will last, so wait up to X seconds can work one day and give problems the other day.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Than it would be better to use FM SHOW_JOBSTATE and see if report is finished. But you have to do this a DO - ENDDO / WHILE - ENDWHILE.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 23 Apr 2008 19:25:49 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/submit-and-wait/m-p/3787559#M911211</guid>
      <dc:creator>Sm1tje</dc:creator>
      <dc:date>2008-04-23T19:25:49Z</dc:date>
    </item>
    <item>
      <title>Re: Submit and Wait ?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/submit-and-wait/m-p/3787560#M911212</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks Mike.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Your solution work well &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
    call function 'JOB_OPEN'
      exporting
        jobname          = v_jobname
      importing
        jobcount         = v_jobcount
      exceptions
        cant_create_job  = 01
        invalid_job_data = 02
        jobname_missing  = 03
        others           = 99.

    submit ygenr001
                    via job v_jobname
                    number v_jobcount
                    to sap-spool without spool dynpro
                    spool parameters wa_params
                    and return.

" Simply call the JOB_SUBMIT with extpgm_wait_for_termination = 'X'
" that will wait for step to complete.

      call function 'JOB_SUBMIT'
        exporting
          authcknam                   = sy-uname
          extpgm_wait_for_termination = 'X'
          jobcount                    = v_jobcount
          jobname                     = v_jobname
        exceptions
          bad_priparams               = 1
          bad_xpgflags                = 2
          invalid_jobdata             = 3
          jobname_missing             = 4
          job_notex                   = 5
          job_submit_failed           = 6
          lock_failed                 = 7
          program_missing             = 8
          prog_abap_and_extpg_set     = 9
          others                      = 10.


    call function 'JOB_CLOSE'
      exporting
        jobcount          = v_jobcount
        jobname           = v_jobname
        strtimmed         = 'X'
      importing
        job_was_released  = v_job_released
      exceptions
        invalid_startdate = 01
        jobname_missing   = 02
        job_close_failed  = 03
        job_nosteps       = 04
        job_notex         = 05
        lock_failed       = 06
        others            = 99.

  perfrom send_mail using v_spool_no.

&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Sa_R&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 23 Apr 2008 20:06:06 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/submit-and-wait/m-p/3787560#M911212</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-04-23T20:06:06Z</dc:date>
    </item>
  </channel>
</rss>

