<?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: sample code for executing a job every week in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/sample-code-for-executing-a-job-every-week/m-p/1611529#M274137</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;here i am giving the intervel as 15 minitues..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;There are two ways for you to handle, &lt;/P&gt;&lt;P&gt;one manually setting up the job through SM36 which is better and convinient, &lt;/P&gt;&lt;P&gt;secondly through program using FM's JOB_OPEN, SUBMIT, JOB_CLOSE.&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;  Find below steps in doing both:&lt;/P&gt;&lt;P&gt;Procedure 1:&lt;/P&gt;&lt;P&gt;  1. Goto Trans -&amp;gt; SM36&lt;/P&gt;&lt;P&gt;  2. Define a job with the program and variant if any&lt;/P&gt;&lt;P&gt;  3. Click on start condition in application tool bar&lt;/P&gt;&lt;P&gt;  4. In the pop-up window, click on Date/Time&lt;/P&gt;&lt;P&gt;  5. Below you can see a check box "Periodic Job"&lt;/P&gt;&lt;P&gt;  6. Next click on Period Values&lt;/P&gt;&lt;P&gt;  7. Select "Other Period"&lt;/P&gt;&lt;P&gt;  8. Now give '15' for Minutes&lt;/P&gt;&lt;P&gt;  9. Save the job&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;Procedure 2 via Program:&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;Below is a sample code for the same. Note the ZTEMP2 is the program i am scheduling with 15mins frequency.&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;DATA: P_JOBCNT LIKE TBTCJOB-JOBCOUNT,&lt;/P&gt;&lt;P&gt;      L_RELEASE(1) TYPE c.&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;   CALL FUNCTION 'JOB_OPEN'&lt;/P&gt;&lt;P&gt;     EXPORTING&lt;/P&gt;&lt;P&gt;       JOBNAME                = 'ZTEMP2' &lt;/P&gt;&lt;P&gt;    IMPORTING&lt;/P&gt;&lt;P&gt;      JOBCOUNT               = P_JOBCNT&lt;/P&gt;&lt;P&gt;    EXCEPTIONS&lt;/P&gt;&lt;P&gt;      CANT_CREATE_JOB        = 1&lt;/P&gt;&lt;P&gt;      INVALID_JOB_DATA       = 2&lt;/P&gt;&lt;P&gt;      JOBNAME_MISSING        = 3&lt;/P&gt;&lt;P&gt;      OTHERS                 = 4.&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;MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;        WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;   ENDIF.&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;   SUBMIT ZTEMP2 VIA JOB 'ZTEMP2' NUMBER P_JOBCNT&lt;/P&gt;&lt;P&gt;          TO SAP-SPOOL WITHOUT SPOOL DYNPRO &lt;/P&gt;&lt;P&gt;          WITH DESTINATION = 'HPMISPRT'&lt;/P&gt;&lt;P&gt;          WITH IMMEDIATELY = SPACE&lt;/P&gt;&lt;P&gt;          WITH KEEP_IN_SPOOL = 'X' AND RETURN.&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;   CALL FUNCTION 'JOB_CLOSE'&lt;/P&gt;&lt;P&gt;     EXPORTING&lt;/P&gt;&lt;P&gt;       JOBCOUNT                          = P_JOBCNT&lt;/P&gt;&lt;P&gt;       JOBNAME                           = 'ZTEMP2' &lt;/P&gt;&lt;P&gt;       STRTIMMED                         = 'X'&lt;/P&gt;&lt;P&gt;       PRDMINS                          = 15&lt;/P&gt;&lt;P&gt;    IMPORTING&lt;/P&gt;&lt;P&gt;      JOB_WAS_RELEASED                  = L_RELEASE&lt;/P&gt;&lt;P&gt;    EXCEPTIONS&lt;/P&gt;&lt;P&gt;      CANT_START_IMMEDIATE              = 1&lt;/P&gt;&lt;P&gt;      INVALID_STARTDATE                 = 2&lt;/P&gt;&lt;P&gt;      JOBNAME_MISSING                   = 3&lt;/P&gt;&lt;P&gt;      JOB_CLOSE_FAILED                  = 4&lt;/P&gt;&lt;P&gt;      JOB_NOSTEPS                       = 5&lt;/P&gt;&lt;P&gt;      JOB_NOTEX                         = 6&lt;/P&gt;&lt;P&gt;      LOCK_FAILED                       = 7&lt;/P&gt;&lt;P&gt;      INVALID_TARGET                    = 8&lt;/P&gt;&lt;P&gt;      OTHERS                            = 9.&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;MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;        WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;   ENDIF.&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;Hope the above helps you.&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;Kind Regards&lt;/P&gt;&lt;P&gt;anver&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if helped mark points&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 03 Oct 2006 04:50:39 GMT</pubDate>
    <dc:creator>anversha_s</dc:creator>
    <dc:date>2006-10-03T04:50:39Z</dc:date>
    <item>
      <title>sample code for executing a job every week</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/sample-code-for-executing-a-job-every-week/m-p/1611527#M274135</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;can i hav a sample code to execute to proceess, i.e send the data stored in my tables, every week...(n only once a week, depending, wen i schedule it)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;regards,&lt;/P&gt;&lt;P&gt;Vishal&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 03 Oct 2006 04:27:14 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/sample-code-for-executing-a-job-every-week/m-p/1611527#M274135</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-10-03T04:27:14Z</dc:date>
    </item>
    <item>
      <title>Re: sample code for executing a job every week</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/sample-code-for-executing-a-job-every-week/m-p/1611528#M274136</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The sequence of calling the FM`s would be as follows :&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;JOB_OPEN&lt;/P&gt;&lt;P&gt;JOB_SUBMIT&lt;/P&gt;&lt;P&gt;JOB_CLOSE.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The parameters as  in the FM JOB_CLOSE would schedule the job every 1week =  min&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 03 Oct 2006 04:33:03 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/sample-code-for-executing-a-job-every-week/m-p/1611528#M274136</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-10-03T04:33:03Z</dc:date>
    </item>
    <item>
      <title>Re: sample code for executing a job every week</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/sample-code-for-executing-a-job-every-week/m-p/1611529#M274137</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;here i am giving the intervel as 15 minitues..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;There are two ways for you to handle, &lt;/P&gt;&lt;P&gt;one manually setting up the job through SM36 which is better and convinient, &lt;/P&gt;&lt;P&gt;secondly through program using FM's JOB_OPEN, SUBMIT, JOB_CLOSE.&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;  Find below steps in doing both:&lt;/P&gt;&lt;P&gt;Procedure 1:&lt;/P&gt;&lt;P&gt;  1. Goto Trans -&amp;gt; SM36&lt;/P&gt;&lt;P&gt;  2. Define a job with the program and variant if any&lt;/P&gt;&lt;P&gt;  3. Click on start condition in application tool bar&lt;/P&gt;&lt;P&gt;  4. In the pop-up window, click on Date/Time&lt;/P&gt;&lt;P&gt;  5. Below you can see a check box "Periodic Job"&lt;/P&gt;&lt;P&gt;  6. Next click on Period Values&lt;/P&gt;&lt;P&gt;  7. Select "Other Period"&lt;/P&gt;&lt;P&gt;  8. Now give '15' for Minutes&lt;/P&gt;&lt;P&gt;  9. Save the job&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;Procedure 2 via Program:&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;Below is a sample code for the same. Note the ZTEMP2 is the program i am scheduling with 15mins frequency.&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;DATA: P_JOBCNT LIKE TBTCJOB-JOBCOUNT,&lt;/P&gt;&lt;P&gt;      L_RELEASE(1) TYPE c.&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;   CALL FUNCTION 'JOB_OPEN'&lt;/P&gt;&lt;P&gt;     EXPORTING&lt;/P&gt;&lt;P&gt;       JOBNAME                = 'ZTEMP2' &lt;/P&gt;&lt;P&gt;    IMPORTING&lt;/P&gt;&lt;P&gt;      JOBCOUNT               = P_JOBCNT&lt;/P&gt;&lt;P&gt;    EXCEPTIONS&lt;/P&gt;&lt;P&gt;      CANT_CREATE_JOB        = 1&lt;/P&gt;&lt;P&gt;      INVALID_JOB_DATA       = 2&lt;/P&gt;&lt;P&gt;      JOBNAME_MISSING        = 3&lt;/P&gt;&lt;P&gt;      OTHERS                 = 4.&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;MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;        WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;   ENDIF.&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;   SUBMIT ZTEMP2 VIA JOB 'ZTEMP2' NUMBER P_JOBCNT&lt;/P&gt;&lt;P&gt;          TO SAP-SPOOL WITHOUT SPOOL DYNPRO &lt;/P&gt;&lt;P&gt;          WITH DESTINATION = 'HPMISPRT'&lt;/P&gt;&lt;P&gt;          WITH IMMEDIATELY = SPACE&lt;/P&gt;&lt;P&gt;          WITH KEEP_IN_SPOOL = 'X' AND RETURN.&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;   CALL FUNCTION 'JOB_CLOSE'&lt;/P&gt;&lt;P&gt;     EXPORTING&lt;/P&gt;&lt;P&gt;       JOBCOUNT                          = P_JOBCNT&lt;/P&gt;&lt;P&gt;       JOBNAME                           = 'ZTEMP2' &lt;/P&gt;&lt;P&gt;       STRTIMMED                         = 'X'&lt;/P&gt;&lt;P&gt;       PRDMINS                          = 15&lt;/P&gt;&lt;P&gt;    IMPORTING&lt;/P&gt;&lt;P&gt;      JOB_WAS_RELEASED                  = L_RELEASE&lt;/P&gt;&lt;P&gt;    EXCEPTIONS&lt;/P&gt;&lt;P&gt;      CANT_START_IMMEDIATE              = 1&lt;/P&gt;&lt;P&gt;      INVALID_STARTDATE                 = 2&lt;/P&gt;&lt;P&gt;      JOBNAME_MISSING                   = 3&lt;/P&gt;&lt;P&gt;      JOB_CLOSE_FAILED                  = 4&lt;/P&gt;&lt;P&gt;      JOB_NOSTEPS                       = 5&lt;/P&gt;&lt;P&gt;      JOB_NOTEX                         = 6&lt;/P&gt;&lt;P&gt;      LOCK_FAILED                       = 7&lt;/P&gt;&lt;P&gt;      INVALID_TARGET                    = 8&lt;/P&gt;&lt;P&gt;      OTHERS                            = 9.&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;MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;        WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;   ENDIF.&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;Hope the above helps you.&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;Kind Regards&lt;/P&gt;&lt;P&gt;anver&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if helped mark points&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 03 Oct 2006 04:50:39 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/sample-code-for-executing-a-job-every-week/m-p/1611529#M274137</guid>
      <dc:creator>anversha_s</dc:creator>
      <dc:date>2006-10-03T04:50:39Z</dc:date>
    </item>
    <item>
      <title>Re: sample code for executing a job every week</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/sample-code-for-executing-a-job-every-week/m-p/1611530#M274138</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;thanx Anversha..&lt;/P&gt;&lt;P&gt;also, tell me, if i want to schedule it once a week, as per ur 2nd solution, do i need to convert week into minutes...??&lt;/P&gt;&lt;P&gt;or ther is parameter for week itself?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;regards,&lt;/P&gt;&lt;P&gt;Vishal&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 03 Oct 2006 05:05:48 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/sample-code-for-executing-a-job-every-week/m-p/1611530#M274138</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-10-03T05:05:48Z</dc:date>
    </item>
    <item>
      <title>Re: sample code for executing a job every week</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/sample-code-for-executing-a-job-every-week/m-p/1611531#M274139</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;no need .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;chk the FM,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;job close - &amp;gt; option 'PRDWEEKS' is there.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;rgds&lt;/P&gt;&lt;P&gt;anver&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if hlped mark points&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 03 Oct 2006 05:15:49 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/sample-code-for-executing-a-job-every-week/m-p/1611531#M274139</guid>
      <dc:creator>anversha_s</dc:creator>
      <dc:date>2006-10-03T05:15:49Z</dc:date>
    </item>
  </channel>
</rss>

