2014 Feb 14 11:07 AM
Hi All,
My requirement is to write a report(say rep) which will always be executed in the background even if it is executed in the foreground. Now in my program I am doing a check on sy-batch and if it is false then I am doing a job_open, job_submit and job_close AND in the else part I have kept my program logic.
Now in the job_submit, I am passing my prog name(rep) but I am getting an 'invalid_jobdata' error. Does SAP allow to pass the same program name in the job_submit in which it is written. Has anyone experienced a similar situation and can throw some light on this issue. Or is there any other way to achieve this functionality.
2014 Feb 14 11:20 AM
Please check below code :
lv_jobname = 'TEST123'.
CALL FUNCTION 'JOB_OPEN'
EXPORTING
jobname = lv_jobname
IMPORTING
jobcount = lv_jobcount.
CALL FUNCTION 'JOB_SUBMIT'
EXPORTING
authcknam = sy-uname
jobcount = lv_jobcount
jobname = lv_jobname
report = 'ZTEST'
variant = l_var .
.
CALL FUNCTION 'JOB_CLOSE'
EXPORTING
jobcount = lv_jobcount
jobname = lv_jobname
strtimmed = 'X'.
2014 Feb 14 11:25 AM
Hi Anindya,
You can pass the Program name sy-repid into the parameter - REPORT. Along with it, you have to pass job number and job name in the respective parameter. Please pass the variant name as well for the background job processing.
Regards,
Sachin
2014 Feb 14 12:19 PM
Hi Anindya
I try your scenairo. Yes, it allow pass the same program name in the job_submit in which it is written, maybe your parameter is not correct, refer @Chandra mentioned.
regards,
Archer