<?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: How to run a program in background in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-run-a-program-in-background/m-p/12629914#M2013248</link>
    <description>&lt;P&gt;&lt;SPAN class="mention-scrubbed"&gt;mohamed.hamdi&lt;/SPAN&gt; &lt;/P&gt;&lt;P&gt;Hi Mohamed,&lt;/P&gt;&lt;P&gt;your question will be easier to read if you embed images via the 3rd icon from the right in the editor menu and use the last icon "CODE" to add your ABAP-code. You should be able to edit your question accordingly.&lt;/P&gt;&lt;P&gt;Hope this helps!&lt;/P&gt;</description>
    <pubDate>Thu, 17 Nov 2022 10:53:55 GMT</pubDate>
    <dc:creator>BaerbelWinkler</dc:creator>
    <dc:date>2022-11-17T10:53:55Z</dc:date>
    <item>
      <title>How to run a program in background</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-run-a-program-in-background/m-p/12629913#M2013247</link>
      <description>&lt;P&gt;Hello Community, &lt;/P&gt;
  &lt;P&gt;I have an issue with a program that should be executed in the background if I press in the button bellow "1". &lt;/P&gt;
  &lt;P&gt;&lt;IMG class="migrated-image" src="https://community.sap.com/legacyfs/online/storage/attachments/storage/7/attachments/2111036-2111017-sap-enwi.png" /&gt;&lt;/P&gt;
  &lt;P&gt;The principle of the code is simple, if I click on the button, a job must be created, otherwise a simple execution.&lt;/P&gt;
  &lt;P&gt;&lt;IMG class="migrated-image" src="https://community.sap.com/legacyfs/online/storage/attachments/storage/7/attachments/2111038-2111019-sap-enwi-2.png" /&gt;&lt;/P&gt;
  &lt;P&gt;The problem here that after exectuing the program in the background, a message is displayed saying that the job is created. &lt;/P&gt;
  &lt;P&gt;&lt;IMG class="migrated-image" src="https://community.sap.com/legacyfs/online/storage/attachments/storage/7/attachments/2111039-2111020-sap-enwi-3.png" /&gt;&lt;/P&gt;
  &lt;P&gt;Unfortunately, in SM37 there is no job with such description when I try to check. &lt;/P&gt;
  &lt;P&gt;&lt;IMG class="migrated-image" src="https://community.sap.com/legacyfs/online/storage/attachments/storage/7/attachments/2111040-2111022-sap-enwi-4.png" /&gt;&lt;/P&gt;
  &lt;P&gt;Here is the Code for the background execution :&lt;/P&gt; 
  &lt;PRE&gt;&lt;CODE&gt;FORM f_treatment_batch .&lt;BR /&gt;&lt;BR /&gt;  DATA: lv_jobname TYPE tbtcjob-jobname VALUE 'ANNULATION_MES',&lt;BR /&gt;        lv_jobnbre TYPE tbtcjob-jobcount,&lt;BR /&gt;        lv_id      TYPE indx-srtfd.&lt;BR /&gt;&lt;BR /&gt;  CONCATENATE lv_jobname sy-datum INTO lv_jobname SEPARATED BY '_'.&lt;BR /&gt;&lt;BR /&gt;  CALL FUNCTION 'JOB_OPEN'&lt;BR /&gt;    EXPORTING&lt;BR /&gt;      jobname          = lv_jobname&lt;BR /&gt;    IMPORTING&lt;BR /&gt;      jobcount         = lv_jobnbre&lt;BR /&gt;    EXCEPTIONS&lt;BR /&gt;      cant_create_job  = 1&lt;BR /&gt;      invalid_job_data = 2&lt;BR /&gt;      jobname_missing  = 3&lt;BR /&gt;      OTHERS           = 4.&lt;BR /&gt;  IF sy-subrc &amp;lt;&amp;gt; 0.&lt;BR /&gt;* Implement suitable error handling here&lt;BR /&gt;  ENDIF.&lt;BR /&gt;&lt;BR /&gt;  lv_id = 'ANNUL_MES' &amp;amp;&amp;amp; lv_jobnbre.&lt;BR /&gt;  EXPORT gt_mes_immo TO DATABASE indx(zz) ID lv_id.&lt;BR /&gt;&lt;BR /&gt;  SUBMIT zfi_annulation_mes_batch VIA JOB lv_jobname&lt;BR /&gt;                              NUMBER  lv_jobnbre&lt;BR /&gt;                              WITH p_jobnbr EQ lv_jobnbre&lt;BR /&gt;                              WITH p_datc EQ p_datc&lt;BR /&gt;                              WITH p_dever EQ p_dever&lt;BR /&gt;                              WITH p_stock EQ p_stock&lt;BR /&gt;                              WITH p_devst EQ p_devst&lt;BR /&gt;                              WITH p_mes   EQ p_mes&lt;BR /&gt;*                              WITH gt_mes_immo EQ gt_mes_immo&lt;BR /&gt;                              USER sy-uname&lt;BR /&gt;                              TO SAP-SPOOL&lt;BR /&gt;                              WITHOUT SPOOL DYNPRO&lt;BR /&gt;                              AND RETURN.&lt;BR /&gt;&lt;BR /&gt;  CALL FUNCTION 'JOB_CLOSE'&lt;BR /&gt;    EXPORTING&lt;BR /&gt;      jobcount             = lv_jobnbre&lt;BR /&gt;      jobname              = lv_jobname&lt;BR /&gt;      strtimmed            = 'X'&lt;BR /&gt;    EXCEPTIONS&lt;BR /&gt;      cant_start_immediate = 1&lt;BR /&gt;      invalid_startdate    = 2&lt;BR /&gt;      jobname_missing      = 3&lt;BR /&gt;      job_close_failed     = 4&lt;BR /&gt;      job_nosteps          = 5&lt;BR /&gt;      job_notex            = 6&lt;BR /&gt;      lock_failed          = 7&lt;BR /&gt;      invalid_target       = 8&lt;BR /&gt;      invalid_time_zone    = 9&lt;BR /&gt;      OTHERS               = 10.&lt;BR /&gt;  IF sy-subrc &amp;lt;&amp;gt; 0.&lt;BR /&gt;    MESSAGE ID sy-msgid&lt;BR /&gt;      TYPE sy-msgty&lt;BR /&gt;      NUMBER sy-msgno&lt;BR /&gt;      WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.&lt;BR /&gt;  ELSE.&lt;BR /&gt;    MESSAGE s398(00) WITH 'Job' lv_jobname lv_jobnbre 'lancé'.&lt;BR /&gt;    LEAVE TO CURRENT TRANSACTION.&lt;BR /&gt;  ENDIF.&lt;BR /&gt;ENDFORM.&lt;/CODE&gt;&lt;/PRE&gt;
  &lt;P&gt;THANK YOU FOR YOU HELP. &lt;/P&gt;</description>
      <pubDate>Thu, 17 Nov 2022 09:55:55 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-run-a-program-in-background/m-p/12629913#M2013247</guid>
      <dc:creator>former_member834551</dc:creator>
      <dc:date>2022-11-17T09:55:55Z</dc:date>
    </item>
    <item>
      <title>Re: How to run a program in background</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-run-a-program-in-background/m-p/12629914#M2013248</link>
      <description>&lt;P&gt;&lt;SPAN class="mention-scrubbed"&gt;mohamed.hamdi&lt;/SPAN&gt; &lt;/P&gt;&lt;P&gt;Hi Mohamed,&lt;/P&gt;&lt;P&gt;your question will be easier to read if you embed images via the 3rd icon from the right in the editor menu and use the last icon "CODE" to add your ABAP-code. You should be able to edit your question accordingly.&lt;/P&gt;&lt;P&gt;Hope this helps!&lt;/P&gt;</description>
      <pubDate>Thu, 17 Nov 2022 10:53:55 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-run-a-program-in-background/m-p/12629914#M2013248</guid>
      <dc:creator>BaerbelWinkler</dc:creator>
      <dc:date>2022-11-17T10:53:55Z</dc:date>
    </item>
    <item>
      <title>Re: How to run a program in background</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-run-a-program-in-background/m-p/12629915#M2013249</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;you can call a function in background by "starting new task"&lt;/P&gt;&lt;P&gt;&lt;A href="https://help.sap.com/docs/ABAP_PLATFORM_NEW/753088fc00704d0a80e7fbd6803c8adb/4889389984b84e6fe10000000a421937.html?locale=en-US" target="test_blank"&gt;https://help.sap.com/docs/ABAP_PLATFORM_NEW/753088fc00704d0a80e7fbd6803c8adb/4889389984b84e6fe10000000a421937.html?locale=en-US&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 17 Nov 2022 13:08:05 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-run-a-program-in-background/m-p/12629915#M2013249</guid>
      <dc:creator>ThorstenHoefer</dc:creator>
      <dc:date>2022-11-17T13:08:05Z</dc:date>
    </item>
    <item>
      <title>Re: How to run a program in background</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-run-a-program-in-background/m-p/12629916#M2013250</link>
      <description>&lt;PRE&gt;&lt;CODE&gt;    CALL FUNCTION 'JOB_OPEN' ...

    SUBMIT z_my_program
           VIA JOB lv_nom_job
           NUMBER  lv_numero_job
           WITH p_toto = iv_toto
           AND RETURN.

     CALL FUNCTION 'JOB_CLOSE' ...&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 17 Nov 2022 14:10:47 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-run-a-program-in-background/m-p/12629916#M2013250</guid>
      <dc:creator>FredericGirod</dc:creator>
      <dc:date>2022-11-17T14:10:47Z</dc:date>
    </item>
    <item>
      <title>Re: How to run a program in background</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-run-a-program-in-background/m-p/12629917#M2013251</link>
      <description>&lt;P&gt;I confirm that it will be much easier for us to read your question with the images embedded, instead of attaching the screenshots as hyperlinks.&lt;/P&gt;&lt;P&gt;It's also faster for you to take a screenshot and directly paste it in the text using Ctrl+V.&lt;/P&gt;</description>
      <pubDate>Thu, 17 Nov 2022 14:49:35 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-run-a-program-in-background/m-p/12629917#M2013251</guid>
      <dc:creator>Sandra_Rossi</dc:creator>
      <dc:date>2022-11-17T14:49:35Z</dc:date>
    </item>
    <item>
      <title>Re: How to run a program in background</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-run-a-program-in-background/m-p/12629918#M2013252</link>
      <description>&lt;P&gt;Hi &lt;SPAN class="mention-scrubbed"&gt;mohamed.hamdi&lt;/SPAN&gt;,&lt;/P&gt;&lt;P&gt;A good alternative would be to save as Variant &amp;amp; then ask your Basis resource to trigger a Job via SM36. Other options &lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Kaushik&lt;/P&gt;</description>
      <pubDate>Thu, 17 Nov 2022 14:54:02 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-run-a-program-in-background/m-p/12629918#M2013252</guid>
      <dc:creator>kaus19d</dc:creator>
      <dc:date>2022-11-17T14:54:02Z</dc:date>
    </item>
    <item>
      <title>Re: How to run a program in background</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-run-a-program-in-background/m-p/12629919#M2013253</link>
      <description>&lt;P&gt;Thank you for the notes, I have edited my question. &lt;/P&gt;</description>
      <pubDate>Thu, 17 Nov 2022 16:25:03 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-run-a-program-in-background/m-p/12629919#M2013253</guid>
      <dc:creator>former_member834551</dc:creator>
      <dc:date>2022-11-17T16:25:03Z</dc:date>
    </item>
    <item>
      <title>Re: How to run a program in background</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-run-a-program-in-background/m-p/12629920#M2013254</link>
      <description>&lt;P&gt;Hi M Hamdi,&lt;/P&gt;&lt;P&gt;Here are common reasons for not finding jobs in SM37:&lt;/P&gt;&lt;UL&gt;
&lt;LI&gt;A filter is set for the user. To remove the filter, display any job in SM37, then go in menu Edit (Traiter), Delete filter (Supprimer filtres).&lt;/LI&gt;&lt;LI&gt;The job status is Scheduled but the "Sched." ("Planif.") checkbox is not checked by default.&lt;/LI&gt;&lt;LI&gt;Slight difference in the job name. Try using some wildcard characters (*).&lt;/LI&gt;&lt;LI&gt;The job was run with a different user. Use of a batch user is common, so entering * in the User name field (Nom d'utilisateur) sometimes help.&lt;/LI&gt;&lt;LI&gt;The job is triggered after an event. If it is the case and none is specified it won't be found. Specify the event or just enter * to include all jobs that are run after an event.&lt;/LI&gt;&lt;LI&gt;The date/time selection is not valid. Make sure it includes the desired times.&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;In this particular case you didn't write the correct program name in the selection screen of SM37 (ZFI_ANNULATION_MES instead of ZFI_ANNULATION_MES_BATCH). That's probably the only problem.&lt;/P&gt;&lt;P&gt;I hope this helps.&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;&lt;P&gt;Patrice&lt;/P&gt;</description>
      <pubDate>Fri, 18 Nov 2022 16:03:23 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-run-a-program-in-background/m-p/12629920#M2013254</guid>
      <dc:creator>Patrice</dc:creator>
      <dc:date>2022-11-18T16:03:23Z</dc:date>
    </item>
    <item>
      <title>Re: How to run a program in background</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-run-a-program-in-background/m-p/12629921#M2013255</link>
      <description>&lt;P&gt;Hi Thorsten,&lt;/P&gt;&lt;P&gt;M Hamdi is asking for a program, not a Function Module.&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;&lt;P&gt;Patrice&lt;/P&gt;</description>
      <pubDate>Fri, 18 Nov 2022 16:03:35 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-run-a-program-in-background/m-p/12629921#M2013255</guid>
      <dc:creator>Patrice</dc:creator>
      <dc:date>2022-11-18T16:03:35Z</dc:date>
    </item>
    <item>
      <title>Re: How to run a program in background</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-run-a-program-in-background/m-p/12629922#M2013256</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;why can't you call the program in the function modul to start it asynchron?&lt;/P&gt;</description>
      <pubDate>Sat, 19 Nov 2022 18:15:56 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-run-a-program-in-background/m-p/12629922#M2013256</guid>
      <dc:creator>ThorstenHoefer</dc:creator>
      <dc:date>2022-11-19T18:15:56Z</dc:date>
    </item>
    <item>
      <title>Re: How to run a program in background</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-run-a-program-in-background/m-p/12629923#M2013257</link>
      <description>&lt;P&gt;Hi Thorsten,&lt;/P&gt;&lt;P&gt;He could, but it is not what he is asking and I fail to see what would be gained from doing that. The SUBMIT command works and the job is created. He is just asking why he can't see his job in SM37. And the answer is probably that he didn't write the correct program name in the selection screen (ZFI_ANNULATION_MES instead of ZFI_ANNULATION_MES_BATCH).&lt;/P&gt;&lt;P&gt;Patrice&lt;/P&gt;</description>
      <pubDate>Thu, 24 Nov 2022 21:01:34 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-run-a-program-in-background/m-p/12629923#M2013257</guid>
      <dc:creator>Patrice</dc:creator>
      <dc:date>2022-11-24T21:01:34Z</dc:date>
    </item>
  </channel>
</rss>

