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

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

Jacek_Dev
Explorer
0 Likes
1,793

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

1 ACCEPTED SOLUTION
Read only

Jacek_Dev
Explorer
0 Likes
1,539

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!

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

3 REPLIES 3
Read only

NTeunckens
Active Contributor
1,539

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

Read only

Jacek_Dev
Explorer
0 Likes
1,540

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!

Read only

nomssi
Active Contributor
1,539

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.