• 分JOB实例


    *&---------------------------------------------------------------------*
    *&      Form  F_SET_JOB
    *&---------------------------------------------------------------------*
    *       text
    *----------------------------------------------------------------------*
    *  -->  p1        text
    *  <--  p2        text
    *----------------------------------------------------------------------*
    form f_set_job .
      data:lt_item like table of zsdt017item_t,
           ls_item like zsdt017item_t.
      data:lt_tbtco like table of tbtco with header line.
      data:lv_jobing type i,
           lv_jobs   type i,
           lv_p      type i,
           lv_i       type i.
    
    
      select * from zfit139 into table gt_zfit139.
      sort gt_zfit139 by zpara.
    ***从配置表里读取出job信息
      read table gt_zfit139 into gs_zfit139 with key zpara = '1072JO' binary search.
      if sy-subrc = 0.
        lv_jobs = gs_zfit139-zchar.
      else.
        lv_jobs = '20'.
      endif.
      clear: gs_zfit139.
      read table gt_zfit139 into gs_zfit139 with key zpara = '1072NU' binary search.
      if sy-subrc = 0.
        lv_p = gs_zfit139-zchar.
      else.
        lv_p = 3000.
      endif.
      clear: gs_zfit139.
    
      clear: lv_i.
    **处理取到的数据
      do.
        if gt_item is initial.
          exit.
        endif.
        lv_i = lv_i + 1."分JOB数
        clear: lt_item,r_itemid[].
        append lines of gt_item from 1 to lv_p to lt_item.
    *****V1.0DELETE BY 88392028 FOR AT 20181113 BEGIN*****
    *    r_itemid(3) = 'IEQ'.
    *    LOOP AT lt_item INTO ls_item.
    *      r_itemid-low = ls_item-order_item_id.
    *      APPEND r_itemid.
    *    ENDLOOP.
    *    CLEAR:r_itemid.
    *****V1.0DELETE BY 88392028 FOR AT 20181113 E N D*****
    
    
        clear: r_no[].
        r_no(3) = 'IEQ'.
        loop at lt_item into ls_item.
          concatenate ls_item-order_item_id  ls_item-order_status into r_no-low separated by '|'.
          append r_no.
        endloop.
        clear:r_no.
    
        delete gt_item from 1 to lv_p.
        do.
          clear: lv_jobing.
          refresh: lt_tbtco.
          select *
            into corresponding fields of table lt_tbtco
            from tbtco
           where jobname like 'ZDQFI_1072SO%'
             and status = 'R'."运行中
          lv_jobing = lines( lt_tbtco ).
          if lv_jobing >= lv_jobs.
            wait up to 10 seconds.
          else.
            exit.
          endif.
        enddo.
    
    *G_INDEXC = SY-INDEX.
        g_index = lv_i.
        concatenate g_name1 '_' g_index into g_name.
        perform f_job_open.
        if sy-subrc = 0.
          submit zdqfi_1072 with s_itemid in r_itemid
                            with s_flag   in s_flag
                            with s_no     in r_no
                            to sap-spool
                            spool parameters g_print_parameters
                            without spool dynpro
                            via job g_name number g_number
                            and return.
          if sy-subrc = 0.
            perform f_job_close.
            if sy-subrc <> 0.
              write :/5 'CLOSE JOB FAIL!'.
              leave program.
            endif.
          endif.
        else.
          write:/5 'CREATE JOB FAIL!'.
          leave program.
        endif.
      enddo.
      write :/5 'SUBMIT ZDQFI_1072','JOBNUM',g_number,'TOTAL:',lv_i.
      refresh: lt_item,r_itemid[].
    
    endform.                    " F_SET_JOB
    *&---------------------------------------------------------------------*
    *&      Form  F_JOB_OPEN
    *&---------------------------------------------------------------------*
    *       text
    *----------------------------------------------------------------------*
    *  -->  p1        text
    *  <--  p2        text
    *----------------------------------------------------------------------*
    form f_job_open .
      call function 'JOB_OPEN'
        exporting
          jobname          = g_name
        importing
          jobcount         = g_number
        exceptions
          cant_create_job  = 1
          invalid_job_data = 2
          jobname_missing  = 3
          others           = 4.
    endform.                    " F_JOB_OPEN
    *&---------------------------------------------------------------------*
    *&      Form  F_JOB_CLOSE
    *&---------------------------------------------------------------------*
    *       text
    *----------------------------------------------------------------------*
    *  -->  p1        text
    *  <--  p2        text
    *----------------------------------------------------------------------*
    form f_job_close .
      call function 'JOB_CLOSE'
        exporting
          jobcount             = g_number
          jobname              = g_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.
    endform.                    " F_JOB_CLOSE
  • 相关阅读:
    sublime3 常用快捷键
    sublime3 常用插件
    前端整理——css部分
    JS数组与对象的遍历方法大全
    Javascript 异步加载详解
    五大主流浏览器内核的源起以及国内各大浏览器内核总结
    JavaScript的分支结构(switch,if..else)
    js---作用域,作用域链,立即执行函数,闭包
    js预编译
    利用js实现轮播图
  • 原文地址:https://www.cnblogs.com/rainysblog/p/10815670.html
Copyright © 2020-2023  润新知