Application Development 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: 

Forcing timeout of RFC function call

Former Member
0 Kudos

I have an abap that calls a function module in another SAP system which returns relevant data for my ABAP.

Sometimes, due to data issues, the called function module gets in some sort of loop where it will eventually timeout.

Is there a way to call the function module with some sort of timeout value in the calling system, or having some sort of timeoue value in the called system?

All this needs to happen in the background.

5 REPLIES 5

former_member182371
Active Contributor
0 Kudos

Hi,

maybe you could use function module RFC_VERIFY_DESTINATION just before calling your RFC fm.

Check this weblog:

/people/sap.user72/blog/2005/07/01/my-new-best-friend-mr-rfcverifydestination

Best regards.

Edited by: Pablo Casamayor on Dec 23, 2009 4:27 PM

0 Kudos

Sorry, I should have been more detailed in what I need and what the issue is.

There isn't an issue with the RFC destination itself.

I need a method of performing a timeout of an RFC call after X seconds if the RFC call hasn't returned within X seconds.

This quick test seems to work:


REPORT  ztimeouttest.

Data:   results_received TYPE c,
  timeout type i,
  start type tims,
  stop type tims.


start = SY-UZEIT.
timeout = 5.

CLEAR: results_received.
call function 'RS_TREE_SLEEP'
  starting new task 'check'
  performing receive_result on end of task
  exporting
    TIME_BETWEEN_REFRESH = 50.

WAIT UNTIL results_received = 'X' UP TO timeout SECONDS.

stop =  SY-UZEIT.
IF sy-subrc = 8.    "timeout
  write:/ 'Timeout.  Started at ', start,  ' ended at ', stop.
endif.



FORM receive_result USING iv_taskname.
  RECEIVE RESULTS FROM FUNCTION 'RS_TREE_SLEEP'.



  results_received = 'X'.
endform.

0 Kudos

Hi,

in the weblog i´ve included it says:

Oh, another really nice feature is the TIMEOUT default is set to 60 (seconds) so you can really fine tune your connection settings to get the performance you want, I mean no sense in pulling a huge set of data over if your connection takes to long now is it?

Maybe you could have a look at code of RFC_VERIFY_DESTINATION fm and try to imitate the behaviour of parameter TIMEOUT for your fm.

Best regards.

0 Kudos

Seems I was on the right track.

The timeout stuff is:


..
    CALL FUNCTION 'RFC_GET_SYSTEM_INFO'
      DESTINATION 'NONE'
      STARTING NEW TASK destination
      PERFORMING return_form ON END OF TASK
..
..

WAIT UNTIL data_received = 'X' UP TO timeout SECONDS.

Thanks for the reply though as it backs up what I'm doing.