Skip to Content

How to set a time out for parallel tasks (started with CALL FUNCTION STARTING NEW TASK)?

Oct 02, 2017 at 04:09 PM


avatar image

Dear ABAP Fellows :)

Is there a reliable way to enforce a time out for a parallel task started using:


Let say I want to start 3 parallel tasks with different time outs:

Task 1 - 10 seconds

Task 2 - 20 seconds

Task 3 - 30 seconds

Any suggestions how to achieve this?



10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

2 Answers

Nic Teunckens Oct 02, 2017 at 08:48 PM

I think you can achieve this by using :

WAIT UNTIL data_received_from_fm = abap_true UP TO nmbr_of_seconds SECONDS.

SAP-Help "WAIT (UNTIL)" : link

SAP-Wiki Parallel Processing : link

10 |10000 characters needed characters left characters exceeded
Jacek Kopcinski Feb 09 at 02:39 PM

Sorry for the long inactivity in the topic. I couldn't find a solution until just recently.

WAIT UNTIL command is just a part of the solution as the started tasks will continue to run in the background (even after the parent program finishes).

To terminate them (and free up resources) function module RFC_CONNECTION_CLOSE should be called passing task name as a parameter (task name as specified in CALL FUNCTION...STARTING NEW TASK taskname).

Thank you for the hint!

Show 1 Share
10 |10000 characters needed characters left characters exceeded

I have tried to find out if/how ABAP unit tests execution time is limited. I found Class CL_AUNIT_CLASSTEST_SESSIONFE, Method __CANCEL_RFC does what you are proposing.

I will try to replicate it.