2021 Nov 04 3:35 PM
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);
2021 Nov 04 6:12 PM
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.
2021 Nov 05 6:37 AM
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.