<?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: Executing a subroutine in background in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/executing-a-subroutine-in-background/m-p/6224288#M1379617</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Poornima,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;When you are using function module in background and if you want to debug the same &lt;/P&gt;&lt;P&gt;then you have to use " &lt;STRONG&gt;Commit work statement&lt;/STRONG&gt; " .&lt;/P&gt;&lt;P&gt;For more info have a glance on the below link&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A class="jive_macro jive_macro_message" href="https://community.sap.com/" __jive_macro_name="message" modifiedtitle="true" __default_attr="1303090"&gt;&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Cheers!!&lt;/P&gt;&lt;P&gt;VEnk@&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 12 Oct 2009 10:23:03 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2009-10-12T10:23:03Z</dc:date>
    <item>
      <title>Executing a subroutine in background</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/executing-a-subroutine-in-background/m-p/6224285#M1379614</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have a small requirement to execute a piece of code in background.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It is basically a subroutine which calls a BAPI to update the database.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;the first idea u thought of was to change the subroutine into a FM and call it in background task.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;or, i was wondering if there's any other method which best suits my simple criteria.&lt;/P&gt;&lt;P&gt;any help would be appreciated&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 12 Oct 2009 09:54:01 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/executing-a-subroutine-in-background/m-p/6224285#M1379614</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-10-12T09:54:01Z</dc:date>
    </item>
    <item>
      <title>Re: Executing a subroutine in background</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/executing-a-subroutine-in-background/m-p/6224286#M1379615</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Poornima,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Replace the subroutine with a Function Module and call it in background. That is the SIMPLE and BEST option for the requirement. Dont look for alternatives.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best Regards,&lt;/P&gt;&lt;P&gt;Ram.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 12 Oct 2009 10:10:25 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/executing-a-subroutine-in-background/m-p/6224286#M1379615</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-10-12T10:10:25Z</dc:date>
    </item>
    <item>
      <title>Re: Executing a subroutine in background</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/executing-a-subroutine-in-background/m-p/6224287#M1379616</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Is there any way to debug a FM in background task?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I cant do that from SM37 as this doesn't seem to create a job&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 12 Oct 2009 10:18:35 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/executing-a-subroutine-in-background/m-p/6224287#M1379616</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-10-12T10:18:35Z</dc:date>
    </item>
    <item>
      <title>Re: Executing a subroutine in background</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/executing-a-subroutine-in-background/m-p/6224288#M1379617</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Poornima,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;When you are using function module in background and if you want to debug the same &lt;/P&gt;&lt;P&gt;then you have to use " &lt;STRONG&gt;Commit work statement&lt;/STRONG&gt; " .&lt;/P&gt;&lt;P&gt;For more info have a glance on the below link&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A class="jive_macro jive_macro_message" href="https://community.sap.com/" __jive_macro_name="message" modifiedtitle="true" __default_attr="1303090"&gt;&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Cheers!!&lt;/P&gt;&lt;P&gt;VEnk@&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 12 Oct 2009 10:23:03 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/executing-a-subroutine-in-background/m-p/6224288#M1379617</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-10-12T10:23:03Z</dc:date>
    </item>
    <item>
      <title>Re: Executing a subroutine in background</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/executing-a-subroutine-in-background/m-p/6224289#M1379618</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hallo!&lt;/P&gt;&lt;P&gt;Using FM and call it in background task - is the best method for your purpose.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But in some cases is better to use Submit VIA JOB statement.&lt;/P&gt;&lt;P&gt;You can put your subroutine into report and call it like this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;DATA: number          TYPE tbtcjob-jobcount, 
            name             TYPE tbtcjob-jobname VALUE 'JOB_TEST', 
            print_parameters TYPE pri_params. 

... 

CALL FUNCTION 'JOB_OPEN' 
  EXPORTING 
    jobname          = name 
  IMPORTING 
    jobcount         = number 
  EXCEPTIONS 
    cant_create_job  = 1 
    invalid_job_data = 2 
    jobname_missing  = 3 
    OTHERS           = 4. 
IF sy-subrc = 0. 
  SUBMIT submitable TO SAP-SPOOL
 
                    SPOOL PARAMETERS print_parameters
 
                    WITHOUT SPOOL DYNPRO
 
                    VIA JOB name NUMBER number
 
                    AND RETURN.
  IF sy-subrc = 0. 
    CALL FUNCTION 'JOB_CLOSE' 
      EXPORTING 
        jobcount             = number 
        jobname              = name 
        strtimmed            = 'X' 
      EXCEPTIONS 
        cant_start_immediate = 1 
        invalid_startdate    = 2 
        jobname_missing      = 3 
        job_close_failed     = 4 
        job_nosteps          = 5 
        job_notex            = 6 
        lock_failed          = 7 
        OTHERS               = 8. 
    IF sy-subrc &amp;lt;&amp;gt; 0. 
      ... 
    ENDIF. 
  ENDIF. 
ENDIF.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 12 Oct 2009 10:41:58 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/executing-a-subroutine-in-background/m-p/6224289#M1379618</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-10-12T10:41:58Z</dc:date>
    </item>
    <item>
      <title>Re: Executing a subroutine in background</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/executing-a-subroutine-in-background/m-p/6224290#M1379619</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Alright, i've created a FM now and called in background. I've used a COMMIT WORK right after the FM call. doesnt update still.&lt;/P&gt;&lt;P&gt;i tried using a COMMIT WORK inside the FM as well just in case, doesnt work either. am i missing something?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 12 Oct 2009 10:48:32 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/executing-a-subroutine-in-background/m-p/6224290#M1379619</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-10-12T10:48:32Z</dc:date>
    </item>
    <item>
      <title>Re: Executing a subroutine in background</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/executing-a-subroutine-in-background/m-p/6224291#M1379620</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The FM seems to work fine in the foreground. In background task it doesn't execute as i was expecting. how could i debig it?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 12 Oct 2009 11:53:35 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/executing-a-subroutine-in-background/m-p/6224291#M1379620</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-10-12T11:53:35Z</dc:date>
    </item>
    <item>
      <title>Re: Executing a subroutine in background</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/executing-a-subroutine-in-background/m-p/6224292#M1379621</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Use the command JDBG to debug the background job. Hope you are not updating any standard table in the FM&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 12 Oct 2009 12:00:44 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/executing-a-subroutine-in-background/m-p/6224292#M1379621</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-10-12T12:00:44Z</dc:date>
    </item>
    <item>
      <title>Re: Executing a subroutine in background</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/executing-a-subroutine-in-background/m-p/6224293#M1379622</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;HI Poornima,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you can reply to the author who have given the answer then he/she can get back to you soon.&lt;/P&gt;&lt;P&gt;If you are replying to yourself then it will become hard for us to check and reply.&lt;/P&gt;&lt;P&gt;Use commit work as shown&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;CALL FUNCTION '&amp;lt;NAME Function module&amp;gt;'&lt;/P&gt;&lt;P&gt;    EXPORTING&lt;/P&gt;&lt;P&gt;      document_data              = doc_chng&lt;/P&gt;&lt;P&gt;      put_in_outbox              = 'X'&lt;/P&gt;&lt;P&gt;      &lt;STRONG&gt;commit_work                = 'X'&lt;/STRONG&gt;    &lt;/P&gt;&lt;P&gt;TABLES&lt;/P&gt;&lt;P&gt;      packing_list               = t_packing_list&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Cheers!!&lt;/P&gt;&lt;P&gt;VENk@&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 12 Oct 2009 12:00:49 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/executing-a-subroutine-in-background/m-p/6224293#M1379622</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-10-12T12:00:49Z</dc:date>
    </item>
    <item>
      <title>Re: Executing a subroutine in background</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/executing-a-subroutine-in-background/m-p/6224294#M1379623</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;Is COMMIT_WORK an implicit import paramenter for the FM? Could you please explain this bit more? How does this actually work?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 12 Oct 2009 12:46:58 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/executing-a-subroutine-in-background/m-p/6224294#M1379623</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-10-12T12:46:58Z</dc:date>
    </item>
  </channel>
</rss>

