ITPub博客

首页 > Linux操作系统 > Linux操作系统 > 创建后台作业

创建后台作业

原创 Linux操作系统 作者:AntiDesert 时间:2012-05-31 15:17:51 0 删除 编辑
*****创建后台作业*********************
form. create_job using p_prgnm type applname
                      p_jobnm type TBTCJOB-JOBNAME
                      p_strtdate type TBTCJOB-SDLSTRTDT
                      p_strttime type TBTCJOB-SDLSTRTTM
                      p_months type TBTCJOB-PRDMONTHS
                      p_days type TBTCJOB-PRDDAYS
                      p_strtimm type BTCH0000-CHAR1.
data: lc_jobnum like TBTCJOB-JOBCOUNT,
      lt_par_tab TYPE STANDARD TABLE OF rsparams,
      ls_par_tab TYPE rsparams,
      ls_time type TBTCJOB-SDLSTRTTM.
* Create Job
  CALL FUNCTION 'JOB_OPEN'
    EXPORTING
      jobname          =  p_jobnm
*      SDLSTRTDT        = '20120316'
*      SDLSTRTTM      = ls_time
    IMPORTING
      jobcount         = lc_jobnum
    EXCEPTIONS
      cant_create_job  = 1
      invalid_job_data = 2
      jobname_missing  = 3
      OTHERS           = 4.
  IF sy-subrc NE 0.
    MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
            WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
  ELSE.
    SUBMIT (p_prgnm)
          vIA JOB p_jobnm NUMBER lc_jobnum AND RETURN.
    IF sy-subrc EQ 0.
    "CLOSE JOB DEFINITION
    CALL FUNCTION 'JOB_CLOSE'
        EXPORTING
          jobcount             = lc_jobnum
          jobname              = p_jobnm
          SDLSTRTDT            =  p_strtdate
          SDLSTRTTM            = p_strttime
          PRDMONTHS            = p_months
          PRDDAYS              = p_days
          strtimmed            = p_strtimm
        EXCEPTIONS
          cant_start_immediate = 1
          invalid_startdate    = 2
          jobname_missing      = 3
          job_close_failed     = 4
          job_nosteps          = 5
          job_notex            = 6
          lock_failed          = 7
          invalid_target       = 8
          OTHERS               = 9.
      case sy-subrc .
        when 1. message w002(zsum).
        when 2. message w003(zsum).
        when 3. message w004(zsum).
        when 4. message w005(zsum).
        when 5. message w006(zsum).
        when 6. message w007(zsum).
        when 7. message w008(zsum).
        when 8. message w009(zsum).
        when 9. message w010(zsum).
      endcase.

    ENDIF.
  endif.
endform.

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/26168649/viewspace-731565/,如需转载,请注明出处,否则将追究法律责任。

下一篇: 自定义权限对象
请登录后发表评论 登录
全部评论

注册时间:2011-08-14

  • 博文量
    10
  • 访问量
    10578