01-11-2019 7:13 AM
Hello,
I have a Z program which is already scheduled to run everyday. The requirement is to send the job log and job spool as soon as this job is run via email.I already have the code ready with me to send job spool via emal.
My questions are:
1) If I use FM BP_JOBLOG_READ, it asks for job count which I will have to fetch via FM JOB_OPEN. But doesnt JOB_OPEN schedule a job? I already have a job scheduled. I just need the job count.
2) Should I fetch the job log and send mail in the same Z program or should I create a new report via se38 and then add the new report as my next job step in sm37?
Thanks and Regards,
Farzeen Khan.
01-14-2019 10:18 AM
Hello everyone,
Thanks for you valuable comments. I found the solution.
I used GET_JOB_RUNTIME_INFO to get the jobcount. After that I created a FM in which job log is fetched using BP_JOBLOG_READ (passed jobcount as received from FM GET_JOB_RUNTIME_INFO) and mail is sent using FM SO_NEW_DOCUMENT_ATT_SEND_API1.
I called this FM in update task and then did commit work.
01-11-2019 8:31 AM
1. For scheduled job, i think you can read job count from table TBTCO then you dont have to open job to get job count.
2. I think its better to separate it. if you want to do it in one go, then you have to go back to use fm JOB_OPEN...to control the job programatically (not through sm36,sm37) (a new job).
01-11-2019 9:34 AM
So according to your answer:
If I want to code in the same program, I will have to use FM JOB_OPEN. Then what about the job that is already scheduled? Should I delete that job?
If I want a new report, should it be like this?->
JOB_OPEN
SUBMIT ZPROGRAM
BP_JOBLOG_READ
JOB_CLOSE
01-11-2019 4:51 PM
Note that when you schedule a job, you may enter an email, and the spool files will be sent automatically. But not the job log (probably because it's more technical stuff).
01-14-2019 9:33 AM
So your job is already scheduled and periodic, I suppose, so each execution will get its own count number.
So you could (non-exhaustive list)
01-14-2019 10:18 AM
Hello everyone,
Thanks for you valuable comments. I found the solution.
I used GET_JOB_RUNTIME_INFO to get the jobcount. After that I created a FM in which job log is fetched using BP_JOBLOG_READ (passed jobcount as received from FM GET_JOB_RUNTIME_INFO) and mail is sent using FM SO_NEW_DOCUMENT_ATT_SEND_API1.
I called this FM in update task and then did commit work.