09-24-2008 2:11 PM
Hi SAPsimhas,
My requirement is as below.
I will loop through an internal table and create some files with background processing method.(JOB_OPEN,SUBMIT & JOB_CLOSE)
Now once this job is triggered I need to check the status for that job after maximum 10 mins. Its not neccessary that each job will take 10 mins. only,It can be finished in 2 mins also.
Once the job is finished then I will XCOM that file.
So my question is how to code such timer which will check the job status for that job? I have a FM BP_JOB_READ which returns the job status.
Reply is highly appriciated.
09-24-2008 2:27 PM
Try this way
do.
call function 'SHOW_JOBSTATE'
exporting
jobcount = p_jobc
jobname = p_jobn
importing
aborted = v_aborted
finished = v_finished
ready = v_ready
running = v_running
scheduled = v_scheduled
exceptions
jobcount_missing = 1
jobname_missing = 2
job_notex = 3
others = 4.
if v_aborted eq 'X'.
exit.
endif.
if v_finished eq 'X'.
select single * from tbtcp into wa_tbtcp1
where jobname eq p_jobn
and jobcount eq p_jobc.
if sy-subrc eq 0.
move wa_tbtcp1-listident to p_spono.
endif.
exit.
endif.
if v_count le 10.
call function 'ENQUE_SLEEP'
exporting
seconds = 60.
v_count = v_count + 1.
endif.
enddo.
a®
09-24-2008 2:20 PM
Hi
You can create another job to XCOM the file. To schedule the second job, goto TCode SM36, enter relevent parameters. Under the button " Start Condition" you will find a tab after job.
There you can define the first job.
Hope this helps.
Regards,
Rajat
09-24-2008 2:27 PM
Try this way
do.
call function 'SHOW_JOBSTATE'
exporting
jobcount = p_jobc
jobname = p_jobn
importing
aborted = v_aborted
finished = v_finished
ready = v_ready
running = v_running
scheduled = v_scheduled
exceptions
jobcount_missing = 1
jobname_missing = 2
job_notex = 3
others = 4.
if v_aborted eq 'X'.
exit.
endif.
if v_finished eq 'X'.
select single * from tbtcp into wa_tbtcp1
where jobname eq p_jobn
and jobcount eq p_jobc.
if sy-subrc eq 0.
move wa_tbtcp1-listident to p_spono.
endif.
exit.
endif.
if v_count le 10.
call function 'ENQUE_SLEEP'
exporting
seconds = 60.
v_count = v_count + 1.
endif.
enddo.
a®
09-24-2008 2:31 PM
IF the only problem is the troggering i guess you have to loop and do a polling. you can use wait 10 seconds to keep mips small during polling