Skip to Content

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

Dear ABAP Fellows :)

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

CALL FUNCTION .... STARTING NEW TASK

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?

Thanks,

Jacek

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

  • 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

    Add comment
    10|10000 characters needed characters exceeded

  • 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!

    Add comment
    10|10000 characters needed 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.