JOB Kurma ( JOB_OPEN - JOB_CLOSE )

Program içinde JOB kurup çalıştırma kodu ( kullanıcıya job yetkisi gereklidir) :

form F_CREATE_JOB .



*Trigger Parameter Job Only

      data: number           type tbtcjob-jobcount,
            name             type tbtcjob-jobname value `ZMM_JOB_XXX`,
            print_parameters type pri_params.

      call function `JOB_OPEN`
        exporting
          jobname          = name
        importing
          jobcount         = number
        exceptions
          cant_create_job  = 1
          invalid_job_data = 2
          jobname_missing  = 3
          others           4.
      if sy-subrc = 0.

        submit ZMM_XXX_PROGRAM
*                          with p_werks =
*                          with p_kunnr    = ls_data-kunnr

                          to sap-spool
                          spool parameters print_parameters
                          without spool dynpro
                          via job name number number
                          user `BGD-JOB`
                          and return.
        if sy-subrc = 0.
          call function `JOB_CLOSE`
            exporting
              jobcount             = number
              jobname              = name
              strtimmed            = `X`
            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.

          endif.
        endif.
      endif.


endform.                    " F_CREATE_JOB