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 run a function for n seconds?

0 Likes
848

It is possible to stop a program if the runtime is longer than n seconds?

For example, I call a function z_get_partner_contracts.

If the function did not return a result after 5 seconds to stop the execution and return a message.

Php equivalent:

set_time_limit (10);

ini_set ('max_execution_time', 10);

It is possible to stop a program if the runtime is longer than n seconds?

For example, I call a function z_get_partner_contracts.

If the function did not return a result after 5 seconds to stop the execution and return a message.

Php equivalent:

set_time_limit (10);

ini_set ('max_execution_time', 10);

2 REPLIES 2
Read only

Sandra_Rossi
Active Contributor
0 Likes
737

I think the only ABAP concept of maximum runtime is the one defined globally for dialog/RFC tasks (profile parameters rdisp/max_wprun_time, rdisp/scheduler/prio_high/max_runtime, etc.) You can't define a specific one for only one program. You may try something like killing the sessions but that would more like a hack.

Read only

retired_member
Product and Topic Expert
Product and Topic Expert
0 Likes
737

I don't think that there is any convenient way to do it from the caller's side.

But you might program something inside the callee. Pass a parameter for the n seconds and check the runtime at an appropriate position with GET RUN TIME FIELD or UTCLONG_CURRENT.