<?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 FM call in background task in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/fm-call-in-background-task/m-p/2242548#M483616</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 have called a function module in background task. Inside this FM I create application log and put in all the messages in the log which can be viewed using the transaction SLG1. But if the creation of the log fails I want to display the info to the user and exit the FM. I cannot display the info using the Message statement here. I tried to raise an exception, etc. from this FM so that I can process the exception in the calling FM and display a message. But this does not work as the execution of the calling FM and called FM in rfc proceeds simultaneosly. I know I can see the error using transaction sm58 but I am looking for an option wherein I can directly inform the user. Does someone have a suggestion how can proceed with this?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best Regards,&lt;/P&gt;&lt;P&gt;Pooja&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 25 May 2007 09:02:19 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2007-05-25T09:02:19Z</dc:date>
    <item>
      <title>FM call in background task</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/fm-call-in-background-task/m-p/2242548#M483616</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 have called a function module in background task. Inside this FM I create application log and put in all the messages in the log which can be viewed using the transaction SLG1. But if the creation of the log fails I want to display the info to the user and exit the FM. I cannot display the info using the Message statement here. I tried to raise an exception, etc. from this FM so that I can process the exception in the calling FM and display a message. But this does not work as the execution of the calling FM and called FM in rfc proceeds simultaneosly. I know I can see the error using transaction sm58 but I am looking for an option wherein I can directly inform the user. Does someone have a suggestion how can proceed with this?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best Regards,&lt;/P&gt;&lt;P&gt;Pooja&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 25 May 2007 09:02:19 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/fm-call-in-background-task/m-p/2242548#M483616</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-05-25T09:02:19Z</dc:date>
    </item>
    <item>
      <title>Re: FM call in background task</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/fm-call-in-background-task/m-p/2242549#M483617</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;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;In SM37 u can check the status of the jobs that u have assigned to background...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here u mention the job name or the report name to check the status of the job...&lt;/P&gt;&lt;P&gt;After mentioning the job name or program name u just execute it.. ( without any name also u can execute then it gives u all the jobs set by your user name..&lt;/P&gt;&lt;P&gt;the status colud be released,active,finished etc..&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;&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;&lt;/P&gt;&lt;P&gt;Hope the above helps you.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Alternately use CALL FUNCTION func IN BACKGROUND TASK &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Sree&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 25 May 2007 09:04:46 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/fm-call-in-background-task/m-p/2242549#M483617</guid>
      <dc:creator>sreeramkumar_madisetty</dc:creator>
      <dc:date>2007-05-25T09:04:46Z</dc:date>
    </item>
  </channel>
</rss>

