01-31-2007 9:24 PM
Hi Friends,
I want to create a report that will run another program(program2) in background. What I need to do is, when I enter the transaction code of this program(report), it will automatically run the program2 in background. I tried using JOB_OPEN, JOB_SUBMIT and JOB_CLOSE. But when I checked in SM36, the job is just scheduled. I still need to release for the program to run.I should not be doing that anymore. The second program should automatically run when I enter the transaction code.
Please help.
Thanks,
zryxel
01-31-2007 10:00 PM
Did you use 'start immediately' parameter?
CALL FUNCTION 'JOB_CLOSE'
EXPORTING
jobcount = jobcount
jobname = jobname
strtimmed = 'X'. " Start immediately
Another option to consider would be to create an event-periodic job and simply trigger the event in your program (see FM BP_EVENT_RAISE).
01-31-2007 10:00 PM
Did you use 'start immediately' parameter?
CALL FUNCTION 'JOB_CLOSE'
EXPORTING
jobcount = jobcount
jobname = jobname
strtimmed = 'X'. " Start immediately
Another option to consider would be to create an event-periodic job and simply trigger the event in your program (see FM BP_EVENT_RAISE).
01-31-2007 10:13 PM
Hi,
Check this example..
DATA: p_jobcnt LIKE tbtcjob-jobcount,
l_release(1) TYPE c.
<b>* Open the job</b>
CALL FUNCTION 'JOB_OPEN'
EXPORTING
jobname = 'ZMY_OBJ'
IMPORTING
jobcount = p_jobcnt
EXCEPTIONS
cant_create_job = 1
invalid_job_data = 2
jobname_missing = 3
OTHERS = 4.
<b>* Submit the job.</b>
SUBMIT ztest_program VIA JOB 'ZMY_OBJ' NUMBER p_jobcnt
TO SAP-SPOOL WITHOUT SPOOL DYNPRO
WITH destination = 'LOCL'
WITH immediately = space
WITH keep_in_spool = 'X' AND RETURN.
<b>* Close the job.</b>
CALL FUNCTION 'JOB_CLOSE'
EXPORTING
jobcount = p_jobcnt
jobname = 'ZMY_OBJ'
<b>strtimmed = 'X'</b>
prdmins = 15
IMPORTING
job_was_released = l_release.
Thanks,
Naren