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

EXIT statement not working in program in Background Processing

Former Member
0 Likes
947

Hi All,

I have an requirement where job is scheduled every 3minutes and it calls program ZTEST. But, ZTEST might take more than 3 minutes to complete execution. My requirement is that I want o run the jobs sequentially. I mean 2nd job should start only when 1st job ends. I tried using 'After job' in SM37 but it doesnot work.

So,as an alternative, I used funstion module 'TH_GET_WPINFO' to get the if more than one instances of the same program are running or not. Below is the code.

CALL FUNCTION 'TH_GET_WPINFO'

TABLES

wplist = lit_wpinfo

EXCEPTIONS

send_error = 1

OTHERS = 2.

IF sy-subrc = 0.

MOVE sy-repid TO lw_report.

DELETE lit_wpinfo WHERE wp_report <> lw_report. "lw_report has REPORTNAME in it.....

DESCRIBE TABLE lit_wpinfo LINES lw_count.

IF lw_count > 1. " Here I check if 2nd job is executing the same program or not.

EXIT. "Here I want to exit from the program.

ENDIF.

ENDIF.

But, the problem that I am facing is that, the EXIT is not working in background if I write it inside IF statement. I tried using STOP and CHECK statements as well. But, none are working if I write it inside IF statement.

But,if I write EXIT. outside IF statement, it works.

Please let me know,if any one has suggetsions on this.

Thanks.

2 REPLIES 2
Read only

Former Member
0 Likes
581

bad idea srry

Edited by: Manu D'Haeyer on Sep 21, 2011 11:16 PM

Read only

Former Member
0 Likes
581

Hello,

To answer your question, it means lwa_count does not have value more than 1...

Back to your problem to run a job depending on another...

You can use events (transaction SM62) to control Job execution..

1. Create an event and schedule a job with an event and program

2. Use BP_EVENT_RAISE to raise that event which will trigger the job..

Thanks