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: 

BACKGROUND JOB NOT WORKING...

Former Member
0 Kudos

Hi ,

I have created background job from program using JOB OPEN , SUBMIT REPORT , JOB CLOSE .

I can find my job in SM37 with 0 Duration  & in debugging after job creation in submit report event

report is not submitted that's why required job does not run in background.

pls post the suitable solution...

1 ACCEPTED SOLUTION

raymond_giuseppi
Active Contributor
0 Kudos
  • You did not expect that a background job will be able to share memory (import/export) with the called, so I hope you export to something else ?
  • Also in your code, check sy-batch and if set replace LEAVE TO CURRENT TRANSACTION with LEAVE PROGRAM

Regards,

Raymond

15 REPLIES 15

raymond_giuseppi
Active Contributor
0 Kudos

I can find my job in SM37 with 0 Duration

  • What is the exact status of your job displayed in SM37, planned, released, etc. ?
  • What schedule did you pass in JOB_CLOSE FM,strtimmed ?
  • Did you check for sample at scn or help.Sap.com ?

Regards,
Raymond

0 Kudos

Job is being scheduled but not executed , means sumbit report with job name and job number not triggered ......

0 Kudos

Post your code for JOB_CLOSE, if you don't use start immediately, a schedule date/time or an event, the job will stay scheduled. Look at the code sample of help.sap.com at Scheduling a Job: Full-Control Method.

Regards,

Raymond

0 Kudos

Thanks for your reference , but I have done following coding , but cannot submit the report for execution in background and from SM37 find my job but status became canceled....

pls help..

V_JOBNAME = 'E-recharge'.


  CALL FUNCTION 'JOB_OPEN'
        EXPORTING
          JOBNAME = V_JOBNAME
          SDLSTRTDT = SY-DATUM
          SDLSTRTTM = SY-UZEIT

        IMPORTING
            JOBCOUNT = V_JOBCOUNT

         EXCEPTIONS
            CANT_CREATE_JOB = 1
            INVALID_JOB_DATA = 2
            JOBNAME_MISSING = 3
            OTHERS = 4.

SUBMIT ZERECHARGE_CREDIT_ACCOUNTING_B
VIA JOB V_JOBNAME NUMBER V_JOBCOUNT and RETURN.


CALL FUNCTION 'JOB_CLOSE'

   EXPORTING

     jobcount = V_jobcount

     jobname = V_jobname

     strtimmed = 'X'.

0 Kudos
  • Put Job name in Uppercase.
  • Remove SDLSTRTDT and SDLSTRTTM in JOB_OPEN.
  • Check parameters of report.
  • Add USER SY-UNAME to the SUBMIT statement.
  • Check authorization failures via SU53.

Regards,

Raymond

0 Kudos

Thaks for your valuable reply ,

now job is being scheduled and status is finished with zero duration but report not submitted as i checked in debug mode. These are the following requirements for report submission..

1>when we submit report via job name and number

I need to pass select-option & parameter value to calling report and there are the same selection field as called program has.how to pass that for background processing .

2> does the selection screen of of calling program can be suppress with no-display option for BACKGROUND procesing ?

0 Kudos

If the submitted report has the same parameter than its caller, you can try

  • Call FM RS_REFRESH_FROM_SELECTOPTIONS to get the current values of parameters
  • Execute the SUBMIT WITH SELECTION-TABLE option.

Regards,

Raymond

0 Kudos

Hi Samrat,

If there are any obligatory parameters on the selection screen of the report being submitted, then it is required to pass the values for those parameters. You can pass parameters while using SUBMIT statement. Please go through the syntax of SUBMIT statement, you will be able to find the answer. Also if you want to achieve the same using JOB_OPEN, JOB_SUBMIT and JOB_CLOSE function modules, then there is an option available to pass variant in the function module JOB_SUBMIT, it will be helpful. Thank you.

Regards,

Kartik

0 Kudos

Hi Raymond,

    Now I can pass the data by Export/Import into calling program but in  job status is  cancelled with following logs

Job started

Step 001 started (program ZERECHARGE_CREDIT_ACCOUNTING_B, variant &0000000000056, user name 20046

No records found as per selection criteria

"LEAVE TO TRANSACTION" is not allowed in a background job

Job cancelled.

I also check the parameter passing and changes select options into ranges in calling program but still this happend......pls help

0 Kudos

Hi kartik ,

  I created one itab with all selection criteria and EXPORT that before  submit  and in calling program IMPORT that in start-of-selection event and changes all select options into RANGES and value in being mapped properly ...but still job status is cancelled.

0 Kudos

Hi raymond ,

I have already created selection table but if I submit report with selection table how does that submitted report find that selection values in backgroung processing ?

0 Kudos

To check if you have correctly passed the parameters, execute SE38 or SA38, execution with variant and give the temporary variant of the background job in the first screen, not when selection-screen is displayed, I never suggested a export/import statement to pass parameter to a background job...

Regards,

Raymond

raymond_giuseppi
Active Contributor
0 Kudos
  • You did not expect that a background job will be able to share memory (import/export) with the called, so I hope you export to something else ?
  • Also in your code, check sy-batch and if set replace LEAVE TO CURRENT TRANSACTION with LEAVE PROGRAM

Regards,

Raymond

0 Kudos

Hi Raymond ,

  I have been using EXPORT/IMPORT  TO/FROM database index not SHARED MEMORY still the result is same...

Regards ,

SAMRAT

0 Kudos

Hi raymond ,

Thanks for your valuable referenced .

Problem is solved finally. I export  selection table to database index and import it from submitted report in background and working fine. There was some function issue that Vendor was not mapped with company code .....

Regards ,

Samrat