Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Aborting an aRFC

HariPanakkal
Product and Topic Expert
Product and Topic Expert
0 Likes
770

Experts,

There is an aRFC call in my WD screen to get data from BI system for analytics in my screen.

There are chances that user may close the window abruptly after the aRFC is called. So eventhough user close the window

in background aRFC is getting processed , that is not required.

Is it possible to stop or abort the aRFC processing?

My code looks like this:

call function 'BI_FUNCTION_MODULE'

starting new task lv_task_id

calling lo_receiver->receiver_method on end of task

exporting

iv_event_id = lv_event_id

iv_query = 'BI Query Name'

iv_infoprovider = 'Info Provider'

is_bi_query = 'X'

it_selection = lt_selection_parametrs_for_query.

I would like to abort this background task in the WDDOEXIT of my window.

Please suggest a way.

Thanks in Advance.

1 REPLY 1
Read only

Former Member
0 Likes
517

Hi Hari,

Below are my thoughts on your requirement,

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 TH_TX_ABORT to abort this task ID.

I am not sure if you can get the TID of an RFC called via starting new task.

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.


WD_EXIT.
call ZFM_SET_EXIT_FLAG.

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:


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.

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.

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?

Regards,

Chen