<?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: Call function background is not working in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/call-function-background-is-not-working/m-p/6796371#M1466686</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Please cut and paste the real code you are using.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What exactly do you mean by tab2 is not updating?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Rob&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 01 Apr 2010 18:27:04 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2010-04-01T18:27:04Z</dc:date>
    <item>
      <title>Call function background is not working</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/call-function-background-is-not-working/m-p/6796370#M1466685</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi All,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I created an RFC function module with one import parameter and 2 tables.&lt;/P&gt;&lt;P&gt;I am calling this function module in baground &lt;/P&gt;&lt;P&gt;CALL FUNCTION "ABC" IN BACKGROUND TASK&lt;/P&gt;&lt;P&gt;   Exporting &lt;/P&gt;&lt;P&gt;    var = var&lt;/P&gt;&lt;P&gt; tables&lt;/P&gt;&lt;P&gt;  tab1 = tab1&lt;/P&gt;&lt;P&gt;  tab2 = tab2&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;i am passing var and tab1 and updating tab2 in FM&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;tab2 is not updating if i call in BACKGROUND&lt;/P&gt;&lt;P&gt;It is working fine in onlie mode.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Can anyone please through some light on this&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Naveen&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 01 Apr 2010 18:05:21 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/call-function-background-is-not-working/m-p/6796370#M1466685</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-04-01T18:05:21Z</dc:date>
    </item>
    <item>
      <title>Re: Call function background is not working</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/call-function-background-is-not-working/m-p/6796371#M1466686</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Please cut and paste the real code you are using.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What exactly do you mean by tab2 is not updating?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Rob&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 01 Apr 2010 18:27:04 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/call-function-background-is-not-working/m-p/6796371#M1466686</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-04-01T18:27:04Z</dc:date>
    </item>
    <item>
      <title>Re: Call function background is not working</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/call-function-background-is-not-working/m-p/6796372#M1466687</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Rob,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for the reply. Here is the code      &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here i am passking lv_flname, lt_binary_file and updating lt_objbin&lt;/P&gt;&lt;P&gt;in the function module i am going to update lt_objbin.&lt;/P&gt;&lt;P&gt;The reason i am doing this becuase if i use open dataset it failing authorization.&lt;/P&gt;&lt;P&gt;Thats why i want execute these statements in background. These report will be executed by many users, so they can not give authorization for everyone.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;CALL FUNCTION 'ZFI_VIM_OPEN_DATASET' IN BACKGROUND TASK
        EXPORTING
          lt_flname      = lv_flname
        TABLES
          ls_binary_file = lt_binary_file
          ls_objbin      = lt_objbin
        EXCEPTIONS
          error_dataset  = 1
          OTHERS         = 2.

Here is the function module code

FUNCTION zfi_vim_open_dataset.

*"*"Local Interface:
*"  IMPORTING
*"     VALUE(LT_FLNAME) TYPE  CHAR80
*"  TABLES
*"      LS_BINARY_FILE STRUCTURE  TBL1024
*"      LS_OBJBIN STRUCTURE  SOLISTI1
*"  EXCEPTIONS
*"      ERROR_DATASET
 
  OPEN DATASET lt_flname FOR OUTPUT IN BINARY MODE.

  IF sy-subrc = 0.
    LOOP AT ls_binary_file.
      TRANSFER ls_binary_file TO lt_flname.
    ENDLOOP.
    CLOSE DATASET lt_flname.
  ENDIF.
  CLEAR: ls_objbin. REFRESH: ls_objbin.
  OPEN DATASET lt_flname FOR INPUT IN BINARY MODE.
  DO.
    READ DATASET lt_flname INTO ls_objbin.
    IF sy-subrc &amp;lt;&amp;gt; 0.
      CLOSE DATASET lt_flname.
      EXIT.
    ELSE.
      APPEND ls_objbin.
    ENDIF.
  ENDDO.

  DELETE DATASET lt_flname.

ENDFUNCTION.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN __default_attr="red" __jive_macro_name="color"&gt;Moderator message - Please use code tags to format your code&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: Rob Burbank on Apr 1, 2010 3:42 PM&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 01 Apr 2010 19:22:45 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/call-function-background-is-not-working/m-p/6796372#M1466687</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-04-01T19:22:45Z</dc:date>
    </item>
    <item>
      <title>Re: Call function background is not working</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/call-function-background-is-not-working/m-p/6796373#M1466688</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I don't see the exception ERROR_DATASET being set anywhere. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I think you should be doing more return code checking and raising more exceptions.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Rob&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 01 Apr 2010 19:46:09 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/call-function-background-is-not-working/m-p/6796373#M1466688</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-04-01T19:46:09Z</dc:date>
    </item>
    <item>
      <title>Re: Call function background is not working</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/call-function-background-is-not-working/m-p/6796374#M1466689</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If they don't have open dataset "written in code", why would they have authorization for open dataset written in code but stuck inside a function module?  I'd drop the in background task....  The background task is going to be triggered by the same userid, isn't it?  I don't think you'll be able to evade security this way.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If they don't have open dataset, they can't run your program....You'll have to have your batch job processing ID run it (as a background job).  Sounds like security overkill...what huge harm can be done with open dataset when the users can download anything they want in Word or Excel probably and misuse in any way they desire?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 02 Apr 2010 02:07:16 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/call-function-background-is-not-working/m-p/6796374#M1466689</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-04-02T02:07:16Z</dc:date>
    </item>
    <item>
      <title>Re: Call function background is not working</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/call-function-background-is-not-working/m-p/6796375#M1466690</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Naveen,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The [CALL FUNCTION ... IN BACKGROUND TASK|http://help.sap.com/abapdocu_70/en/ABAPCALL_FUNCTION_BACKGROUND_TASK.htm] will only be executed once you do the [COMMIT WORK|http://help.sap.com/abapdocu_70/en/ABAPCOMMIT.htm]. Please check if your coding contains the COMMIT after you triggered the tRFC call (i.e. &lt;EM&gt;in background task&lt;/EM&gt; triggers &lt;EM&gt;tRFC&lt;/EM&gt; calls). &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;As mentioned above, your RFC function should have some proper error handling. If an exception occurs, you could then find it in the outbound RFC queue.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Cheers, harald&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 02 Apr 2010 03:12:51 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/call-function-background-is-not-working/m-p/6796375#M1466690</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-04-02T03:12:51Z</dc:date>
    </item>
  </channel>
</rss>

