matinal:SAP ABAP用程序创建后台作业

2023-10-14 15:30:47 浏览数 (1)

代码语言:javascript复制
DATA: lv_jobnum TYPE btcjobcnt.
DATA: gv_jobname TYPE btcjob VALUE 'ZVBELN_POSTING'. "后台作业名称

CALL FUNCTION 'JOB_OPEN'
  EXPORTING
    jobname = gv_jobname
  IMPORTING
    jobcount = lv_jobnum
  EXCEPTIONS
    cant_create_job = 1
    invalid_job_data = 2
    jobname_missing = 3
    OTHERS = 4.

IF sy-subrc = 0 .

  SUBMIT zsxwms_delivery_confirm1  "后台作业运行的程序
  WITH s_vbeln IN r_vbeln                   "条件
  WITH s_type IN r_type
  WITH s_bwkey IN r_bwkey
  VIA JOB gv_jobname NUMBER lv_jobnum AND RETURN .

  IF sy-subrc = 0 .

    CALL FUNCTION 'JOB_CLOSE'
      EXPORTING
        jobcount = lv_jobnum
        jobname = gv_jobname
        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.

  ENDIF .

ENDIF .

0 人点赞