<?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: Aborting an aRFC in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/aborting-an-arfc/m-p/8036051#M1610283</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Hari,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Below are my thoughts on your requirement,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you were calling the FM in background task, you could have used ID_OF_BACKGROUNDTASK fm to get the TID of the call and use &lt;STRONG&gt;TH_TX_ABORT&lt;/STRONG&gt; to abort this task ID.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am not sure if you can get the TID of an RFC called via &lt;STRONG&gt;starting new task&lt;/STRONG&gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;A logical work around(haven't tried this) would be to declare a global variable in the function group(of the function module that is being called as aRFC) l_exit_flag. And set this flag when the WD is exited. &lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
WD_EXIT.
call ZFM_SET_EXIT_FLAG.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Along with this in your FM that is called as aRFC, you will have to add acheck to see if this is set after possible logical steps within the FM. For ex:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
FUNCTION ZARFC.

if l_exit_flag is initial.
perform f_init_data.
endif.

if l_exit_flag is initial.
perform f_get_data.
endif.

if l_exit_flag is initial.
perform f_process_data.
endif.

if l_exit_flag is initial.
perform f_load_data.
endif.

ENDFUNCTION.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;With this you even though you will not be able to stop the aRFC call immediately, you will be able to stop further processing of it at the next logical step.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Also, wouldn't the closing of the WD automatically close all the associated calls, also since you are receiving results, there might be a possibility that this is being done by the system already. Have you checked/tracked this?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Chen&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 07 Jul 2011 10:01:54 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2011-07-07T10:01:54Z</dc:date>
    <item>
      <title>Aborting an aRFC</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/aborting-an-arfc/m-p/8036050#M1610282</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Experts,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;There is an aRFC call in my WD screen to get data from BI system for analytics in my screen.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;There are chances that user may close the window abruptly after the aRFC is called. So eventhough user close the window&lt;/P&gt;&lt;P&gt;in background aRFC is getting processed , that is not required.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Is it possible to stop or abort the aRFC processing?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My code looks like this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;call function 'BI_FUNCTION_MODULE'&lt;/P&gt;&lt;P&gt;  starting new task lv_task_id&lt;/P&gt;&lt;P&gt;  calling lo_receiver-&amp;gt;receiver_method on end of task&lt;/P&gt;&lt;P&gt;  exporting&lt;/P&gt;&lt;P&gt;    iv_event_id     = lv_event_id&lt;/P&gt;&lt;P&gt;    iv_query        = 'BI Query Name'&lt;/P&gt;&lt;P&gt;    iv_infoprovider = 'Info Provider'&lt;/P&gt;&lt;P&gt;    is_bi_query     = 'X'&lt;/P&gt;&lt;P&gt;    it_selection    = lt_selection_parametrs_for_query.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I would like to abort this background task in the WDDOEXIT of my window.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please suggest a way.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks in Advance.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 07 Jul 2011 05:32:43 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/aborting-an-arfc/m-p/8036050#M1610282</guid>
      <dc:creator>HariPanakkal</dc:creator>
      <dc:date>2011-07-07T05:32:43Z</dc:date>
    </item>
    <item>
      <title>Re: Aborting an aRFC</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/aborting-an-arfc/m-p/8036051#M1610283</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Hari,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Below are my thoughts on your requirement,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you were calling the FM in background task, you could have used ID_OF_BACKGROUNDTASK fm to get the TID of the call and use &lt;STRONG&gt;TH_TX_ABORT&lt;/STRONG&gt; to abort this task ID.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am not sure if you can get the TID of an RFC called via &lt;STRONG&gt;starting new task&lt;/STRONG&gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;A logical work around(haven't tried this) would be to declare a global variable in the function group(of the function module that is being called as aRFC) l_exit_flag. And set this flag when the WD is exited. &lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
WD_EXIT.
call ZFM_SET_EXIT_FLAG.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Along with this in your FM that is called as aRFC, you will have to add acheck to see if this is set after possible logical steps within the FM. For ex:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
FUNCTION ZARFC.

if l_exit_flag is initial.
perform f_init_data.
endif.

if l_exit_flag is initial.
perform f_get_data.
endif.

if l_exit_flag is initial.
perform f_process_data.
endif.

if l_exit_flag is initial.
perform f_load_data.
endif.

ENDFUNCTION.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;With this you even though you will not be able to stop the aRFC call immediately, you will be able to stop further processing of it at the next logical step.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Also, wouldn't the closing of the WD automatically close all the associated calls, also since you are receiving results, there might be a possibility that this is being done by the system already. Have you checked/tracked this?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Chen&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 07 Jul 2011 10:01:54 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/aborting-an-arfc/m-p/8036051#M1610283</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2011-07-07T10:01:54Z</dc:date>
    </item>
  </channel>
</rss>

