10-11-2007 12:12 PM
Hello Experts,
I want to do the job scheduling with following conditions:
There is an interface program which calls other 3 programs.
The requirement is to schedule a background job on daily basis for one of the 3 programs, while other 2 programs need to be run manually. All the 3 programs should be executed through same interface program.
How can I schedule this job?
Full points will be rewarded.
Thanks.
10-12-2007 7:01 AM
Hi Radhika,
Using JOB_SUBMIT in a report program wont schedule the job automatically on daily basis.
Schedule the main program which is using JOB_SUBMIT in SM36.
Provide the frequency of execution & other details viz variant etc. & save the job.
Best regards,
Prashant
10-11-2007 12:17 PM
Hi..
To Schedule programs in Background dynamically (From the Interface program)
You have to call the FMs
1) JOB_OPEN
2) JOB_SUBMIT or SUBMIT <REPORT> VIA BACKGROUND JOB <JOB DETAILS>
3) JOB_CLOSE
Press F1 on SUBMIT statement for more details.
<b>Reward if Helpful.</b>
10-11-2007 12:19 PM
Hi,
When calling other programs which u r not required, If possible write the code
If not sy-batch='X'.
call prog1
call prog2 etc..
endif.
Then it will call programs when it is not in background.
bye.
10-11-2007 12:25 PM
10-11-2007 12:33 PM
1. If you are sure that out of the three programs which one needs to be scheduled then you can achieve it in a single run of interface program.
Let's say it is required to always schedule a program P1 and
programs P2 and P3 needs to be run manually then use the following steps in your code
a) Schedule of P1 using function modules : JOB_OPEN, JOB_SUBMIT and JOB_CLOSE.
b) SUBMIT P2 and return
c) SUBMIT P3 and return.
2. Now if your requirement is to dynamically schedule any one of the three programs then you may go for a "Z" table that will keep track of date & time stamp and the program to be scheduled.
10-12-2007 5:29 AM
Hi Richa,
As u've mentioned, I have the first case wherein I know which program is to be scheduled in background. But in this case, I'm calling the programs through thier transactions from the interface program using "call transaction" statement.
Report ZZZ.
.....................
IF condition.
call transaction XXX.
Elseif condition.
call transaction YYY.
Elseif condition.
call transaction www.
endif.
Lets say progarm for transaction XXX is to be scheduled in background on daily basis.
So can I use submit statement here.
10-11-2007 12:38 PM
In this scenario you have to create a background job dynamically to process the Session in background (for program RSBDCBTC)
This is the Basic code to Achieve that.
Call Function 'JOB_OPEN'
SUBMIT RSBDCBTC
via background Job <Job info>
With QIE = <QID Returned by BDC_OPEN_Group FM>
AND RETURN.
Call Function 'JOB_CLOSE'
10-12-2007 5:47 AM
Hi,
You are correct. You have to use SUBMIT statement or JOB_SUBMIT for the same.
Refer blog : /people/prashant.patil12/blog/2007/02/20/displaying-alv-grid-in-background-job
Best regards,
Prashant
10-12-2007 6:34 AM
Hi Prashant,
Suppose I have scheduled program XXX to run daily using JOB_SUBMIT. Then is it not required to schedule the main program ZZZ through which it is getting called?
The program XXX should be run through main interface program only since it is using some parameters which are exported through main program.
Cam I do this using SM36?
Thanks.
10-12-2007 7:01 AM
Hi Radhika,
Using JOB_SUBMIT in a report program wont schedule the job automatically on daily basis.
Schedule the main program which is using JOB_SUBMIT in SM36.
Provide the frequency of execution & other details viz variant etc. & save the job.
Best regards,
Prashant