Skip to Content
Jan 27, 2021 at 07:16 AM

loop and select from TBTCO to get active status of child job is causing performance issue!


I have a requirement, where parent job waits for all its child job to finish and only then proceed further to next parent job. So, to get the runtime status of childjob, I am looping all the child job ( it_child) and inside loop calling select from TBTCO, to check if child job has finished. If child job finishes I am deleting that entry from it_child.

Now, here issue is with performance of code, DB is being hot too much times to check runtime status of child job. I request experts to let me know if there is any other way we can get runtime status of child job, instead of putting select from TBTCO inside loop?

Below is the code I am trying:

LOOP AT it_child] ASSIGNING <it_child>.
SELECT status FROM tbtco INTO gv_status UP TO 1 ROWS
WHERE jobname = <it_child>-jobname

AND jobcount = <it_child>-jobcount

AND status = 'F'.
IF sy-subrc = 0.
DELETE it_child[].

CLEAR gv_status.

Many Thanks,