on 2008 Mar 19 6:13 PM
We are running SRM 4.0 in extended classic scenario and have R/3 4.70 as our backend.
I have a custom program that is creating a background job that runs the CLEAN_REQREQ_UP program. My question is, is there anyway for me to know when this job has completed? Ideally I'd like the program to submit the background job for CLEAN_REQREQ_UP and then wait for the job to complete before processing further. Anyone have an idea on how to solve this problem?
Best regards,
Shawn O'Connor
Hi,
You can use "Commit Work and Wait" statement after scheduling your backgrnd job and check SY-SUBRC before processing the further task.
BR,
Disha.
Do reward points for useful answers.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Disha-
Thank you for your response. I'm familar with the commit work and wait statements but I'm unsure on how to incorporate them in this example. Could you expand on your thought. Below is my actual code, if you look at the last statement you will see I am utilizing the wait command. This has had limited success as the job doesn't alway complete within the thirty second wait time I've specified. Can you please expand on how I might utilize commit work in combination with the wait statement.
Best regards,
Shawn O'Connor
Create Background Job
call function 'JOB_OPEN'
EXPORTING
delanfrep = ' '
jobgroup = ' '
jobname = jobname
sdlstrtdt = sy-datum
sdlstrttm = sy-uzeit
IMPORTING
jobcount = jobcount
EXCEPTIONS
cant_create_job = 01
invalid_job_data = 02
jobname_missing = 03.
if sy-subrc ne 0.
"error processing
endif.
Insert program into job as step
submit CLEAN_REQREQ_UP
using selection-set 'CLEANER'
user 'SRM_BATCH'
via job jobname
number jobcount
and return.
if sy-subrc > 0.
"error processing
endif.
Close job
starttime-sdlstrtdt = sy-datum.
starttime-sdlstrttm = sy-uzeit.
starttimeimmediate = 'X'.
call function 'JOB_CLOSE'
EXPORTING
jobcount = jobcount
jobname = jobname
strtimmed = starttimeimmediate
IMPORTING
job_was_released = job_released
EXCEPTIONS
cant_start_immediate = 01
invalid_startdate = 02
jobname_missing = 03
job_close_failed = 04
job_nosteps = 05
job_notex = 06
lock_failed = 07
others = 99.
if sy-subrc eq 0.
"error processing
endif.
wait up to w_thirty seconds.
Hi,
In a single if you define multiple objects ( Programs), system automatically trigger the jobs in a sequence you have in a Job.
Hope this resolves your problem.
Thank you
Sreedhar Vetcha
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Sreedhar-
Thank you for your response. I'm not sure I understand your recommendation. In my situation I have custom program that is submitting the CLEAN_REQREQ_UP program via a background job. This is done because you cannot submit the program directly. The submission of the CLEAN_REQREQ_UP program is actually happening in a loop. So I want the job to complete before the next loop is done and consequently submits the job again.
Best regards,
Shawn O'Connor
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.