Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Problem with JOB_SUBMIT

Anindya
Explorer
0 Kudos
209

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.

3 REPLIES 3

Former Member
0 Kudos
106

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'.

Former Member
0 Kudos
106

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

Former Member
0 Kudos
106

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