01-19-2009 5:13 AM
Hi All,
There are 2 programs 'A' and 'B' . During execution of 'A' , 'B' is called and submitted in background using FM Job_open & Job_close and submit query.
My requirement is to Delay the Program 'B' by 2-3 mins without delaying Program 'A' .
I tried using FM JOB_OPEN export condition sdlstrttm = w_starttm but was of no help.
I also tried using statement wait up to 120 seconds but this also makes wait to program 'A'.
Please suggest solutions to this.
Regards,
Nibha
01-19-2009 6:04 AM
Hi,
If you are using SUBMIT & RETURN, then program A would be affected.
If JOB_OPEN is used, then program A should not be affected for adding a WAIT statement in program B.
Best regards,
Prashant
01-19-2009 5:18 AM
Hi,
Have you put the WAIT statement as the first statement in program B? Please do that.
Regards,
Prosenjit.
01-19-2009 5:27 AM
Hi,
where did you put command WAIT UP TO 120 SECONDS? You need to put it in program B. It should not delay program A if you submit it as a background job. The parameter sdlstrttm has description "Do Not Use".
Cheers
01-19-2009 5:28 AM
Hi,
Just check by put the WAIT statement in ur program 'B'.
Thanks.
01-19-2009 5:44 AM
I have put wait statement in Program B only but it is delaying program A too.
01-19-2009 6:04 AM
Hi,
If you are using SUBMIT & RETURN, then program A would be affected.
If JOB_OPEN is used, then program A should not be affected for adding a WAIT statement in program B.
Best regards,
Prashant
01-19-2009 6:59 AM
Hi Prashant,
I am not able to understand ur suggestion.
My piece of code is
call function 'JOB_OPEN'
exporting
jobname = 'YI90C_BG'
sdlstrtdt = w_startdt
sdlstrttm = w_starttm
importing
jobcount = job_count
exceptions
cant_create_job = 1
invalid_job_data = 2
jobname_missing = 3
others = 4.
if sy-subrc <> 0.
message id sy-msgid type sy-msgty number sy-msgno
with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
endif.
if sy-subrc = 0.
submit ympic_source_list_contr_upload
with selection-table it_selcr
and return
via job 'YI90C_BG'
number job_count.
if sy-subrc = 0.
call function 'JOB_CLOSE'
exporting
jobcount = job_count
jobname = 'YI90C_BG'
strtimmed = 'X'
importing
job_was_released = w_status
exceptions
cant_start_immediate = 1
invalid_startdate = 2
jobname_missing = 3
job_close_failed = 4
job_nosteps = 5
job_notex = 6
lock_failed = 7
others = 8.
endif.
endif.
Please tell what changes should I make?
Regards,
Nibha
01-19-2009 7:37 AM
Like Prashant has already mentioned, you are using the SUBMIT AND RETURN, which means that the report A, will continue after B has ended. Do not use the AND RETURN addition.
In JOB_CLOSE you have defined that job will start immediately. For the delay to be effective use the SDLSTRTDT and SDLSTRTTM parameters in JOB_CLOSE (have a look at FM documentation).
01-19-2009 8:07 AM
Hi Micky,
If I remove the code part and return then this is giving error below mentioned:
The addition "VIA JOB" only makes sense with the addition "AND RETURN" .
I checked thru F1 Help. Its like you have to use and with code via job jobname ....
I tried using fields SDLSTRTDT and SDLSTRTTM with delay of 2 mins without removing the code
AND RETURN But In tcode SM37 my job says 'Released'.
Please help.
Regards,
Nibha
01-19-2009 8:19 AM
read the documentation of field SDLSTRTTM see below
In scheduling: Enter the desired start time or latest start time for
your background job. If the job is released,* it is processed at the
specified time*.
01-19-2009 8:19 AM
Hi Nibha,
If its showing as RELEASED, then it means your program is working fine. Once the program is scheduled for background, the status is changed to RELEASED. Once its completed succesfully it should change to FINISHED. Please check the status again in SM37.
If you do not want Program A to be dependent on B, then do not use AND RETURN.
Try using JOB_SUBMIT.
Best regards,
Prashant