10 Replies Latest reply: May 21, 2012 7:45 AM by Akshay Gujrati RSS

Delay in Background Job

Akshay Gujrati
Currently Being Moderated

Dear All,

 

I am scheduling background job using JOB_OPEN SUBMIT JOB_CLOSE.

 

I want to schedule it at a specific time for that I have used two parameters in FM JOB_CLOSE
1.SDLSTRTTM (job schedule time)

2.SDLSTRTDT (job schedule date).

 

Using above parameters I am able to schedule the job at specific time. But every time when the scheduled job time arrives it takes 12 seconds delay to make the job Active from Released status.

     I don't want this delay, kindly help me.

 

 

 

With Regards,

Akshay

  • Re: Delay in Background Job
    Krupa Janiji
    Currently Being Moderated

    See the following example you just set  WAIT UP TO 1 SECONDS.

     

    DATA : new_jobname TYPE tbtcp-jobname ,

      jobcount TYPE tbtcjob-jobcount,

      print_parameters TYPE pri_params,

      user_name TYPE sy-uname,

      default_language TYPE sy-langu,

      rc(4) TYPE c,

      info_msg(125) TYPE c,

      l_variant TYPE raldb-variant VALUE 'SAP&CONNECTINT'.

      new_jobname = 'SENDMAIL'.

      print_parameters-pdest = sy-pdest.

      print_parameters-primm = sy-primm.

      print_parameters-prnew = sy-prnew.

     

      WAIT UP TO 1 SECONDS.

     

      user_name =  sy-uname.

      default_language = sy-langu.

     

    *--   CREATE THE JOB

      CALL FUNCTION 'JOB_OPEN'

        EXPORTING

          jobname          = new_jobname

        IMPORTING

          jobcount         = jobcount

        EXCEPTIONS

          cant_create_job  = 1

          invalid_job_data = 2

          jobname_missing  = 3

          OTHERS           = 4.

     

      IF sy-subrc <> 0.

        MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno

                WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

      ENDIF.

     

    CALL FUNCTION 'JOB_SUBMIT'

        EXPORTING

          authcknam               = sy-uname

          jobcount                = jobcount

          jobname                 = new_jobname

          language                = default_language

          priparams               = print_parameters

          report                  = 'RSCONN01'

          variant                 = l_variant

        EXCEPTIONS

          bad_priparams           = 1

          bad_xpgflags            = 2

          invalid_jobdata         = 3

          jobname_missing         = 4

          job_notex               = 5

          job_submit_failed       = 6

          lock_failed             = 7

          program_missing         = 8

          prog_abap_and_extpg_set = 9

          OTHERS                  = 10.

      IF sy-subrc EQ 4.

        MESSAGE s000(38) WITH 'User cancelled the action'.

      ELSEIF sy-subrc <> 0.

        MOVE sy-subrc TO rc.

        CONCATENATE 'Job Submit Failed. sy-subrc:' rc INTO info_msg

        SEPARATED BY space.

        MESSAGE w208(00) WITH info_msg.

      ELSE.

        MESSAGE 'Background Job Scheduled Successfully' TYPE 'I'.

     

    CALL FUNCTION 'JOB_CLOSE'

          EXPORTING

            jobcount             = jobcount

            jobname              = new_jobname

            strtimmed            = 'X'

    *        targetserver         = 'ctecpci_ECP_02'

          EXCEPTIONS

            cant_start_immediate = 1

            invalid_startdate    = 2

            jobname_missing      = 3

            job_close_failed     = 4

            job_nosteps          = 5

            job_notex            = 6

            lock_failed          = 7

            OTHERS               = 8.

     

        IF sy-subrc <> 0.

          MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno

                  WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

        ENDIF.

      ENDIF.

      LEAVE PROGRAM.

  • Re: Delay in Background Job
    Shambu VS
    Currently Being Moderated

    Hi Akshay,

     

    If your background processes are not free, there will be a delay.

    Check these discussions are suitable for you.

    http://scn.sap.com/thread/1586826

    http://scn.sap.com/thread/1196689

  • Re: Delay in Background Job
    Sandra Rossi
    Currently Being Moderated

    Hi Akshay,

     

    You cannot determine exactly when the job starts; that means "as soon as possible after this time has been reached"; for more information see how the "time-driven scheduler" works, which analyzes start conditions every 60 seconds by default, here: http://help.sap.com/saphelp_nw70/helpdata/en/20/2d513897110872e10000009b38f889/frameset.htm

     

    If you really need to start at an exact time (but I don't advise, as for accounting systems, we usually don't care about jobs running late), you'd better have a job running a certain time before (so that you are comfortable), and wait until the time has been reached.

     

    Regards,

    Sandra

  • Re: Delay in Background Job
    Jyotirmoy Halder
    Currently Being Moderated

    You can change the job class to 'A'

  • Re: Delay in Background Job
    Raymond Giuseppi
    Currently Being Moderated

    This is not an ABAP question, better ask Basis team on parameter rdisp/btctime. Read also Note 519059 - FAQ: Background processing system for better understanding.

     

    (Of course you could submit the job some seconds earlier and use a WAIT statement at the start of the program or adding a first step z-program in case of standard program to start at the exact scheduled time )

     

    Regards,

    Raymond

Actions