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

Avoid multiple execution of ABAP program

Former Member
0 Likes
1,887

Hello,

I've developped a ABAP program which is running in background (per job) every single hour.

I was wondering if there is a way to check whether the program is still active before starting the program the next time.

I actually save the state of the execution in a SAP table. But this solution has one big disadvantage. In case of SAP goes down

for whatever reason (backup, crash,...), the table entry is not resetted and the program doesn't start again, cause table entry indicates that it's still active.

Does someone has an idea on how to check the job queue status within ABAP?

Thx in advance

5 REPLIES 5
Read only

Former Member
0 Likes
1,025

Hi ,

when you create the background job you can put in a condition in the steps.

To execute only after a specified job is executed completely.

Read only

Former Member
0 Likes
1,025

Hi,

Instead of checking job status in Ztable , you can check with FM BP_JOB_READ to know the status.

This will have the status even if the job terminated.

Regards,

Ravi

Read only

deepak_dhamat
Active Contributor
0 Likes
1,025

Hi ,

You can check with

FUNCTION MODULE "TH_WPINFO"

regards

Deepak.

Read only

Former Member
0 Likes
1,025

You can get the background job info in table TBTCO ( Job Status Overview Table ). Check the status of the

earlier job by passing jobname and get its running status.

Thanks,

Pawan

Read only

ThomasZloch
Active Contributor
0 Likes
1,025

Try using standard SAP locking concept for this purpose, e.g. lock object ES_PROG. Set the lock at the start of the program, if this fails, then the report is still running and you can exit there. Locks are being released implicitely at the end of program execution, and as well when the system is being restarted.

Thomas