FORM zcmt2009b_job_frm TABLES pt_itab .
DATA: lv_job_name LIKE tbtco-jobname VALUE 'ZCM0009B', "作业名
lv_job LIKE tbtco-jobname,
lv_job_nr LIKE tbtco-jobcount, "作业号
lv_job_released TYPE c,
lv_job_start_sofort TYPE c,
lv_print_parameters TYPE pri_params,
lt_rspar TYPE TABLE OF rsparams,
lw_line TYPE rsparams.
DATA: ps_itab TYPE tab_memid,
pv_date TYPE d.
"传值给 SELECT-OPTION
REFRESH lt_rspar .
LOOP AT pt_itab INTO ps_itab.
lw_line-selname = 'S_MEMID'.
lw_line-kind = 'S'.
lw_line-sign = 'I'.
lw_line-option = 'EQ'.
lw_line-low = ps_itab-mems_id .
APPEND lw_line TO lt_rspar.
CLEAR: ps_itab,lw_line .
ENDLOOP.
lw_line-selname = 'P_SPLINE'.
lw_line-kind = 'P'.
lw_line-low = p_num .
APPEND lw_line TO lt_rspar.
lw_line-selname = 'P_BATCH'.
lw_line-kind = 'P'.
lw_line-low = 'X' .
APPEND lw_line TO lt_rspar.
pv_date = sy-datum - 60 .
lw_line-selname = 'P_DATE_S'.
lw_line-kind = 'P'.
lw_line-low = pv_date .
APPEND lw_line TO lt_rspar.
lw_line-selname = 'P_DATE_E'.
lw_line-kind = 'P'.
lw_line-low = sy-datum .
APPEND lw_line TO lt_rspar.
* SUBMIT (lv_job_name)
* WITH SELECTION-TABLE lt_rspar
* USER syst-uname " mandatory
* AND RETURN.
"JOB 名称
CLEAR lv_job .
READ TABLE pt_itab INTO ps_itab INDEX 1 .
CONCATENATE lv_job_name '_' ps_itab-mems_id INTO lv_job.
"打开JOB 通过JOB name 获得JOB号
CALL FUNCTION 'JOB_OPEN'
EXPORTING
jobname = lv_job
IMPORTING
jobcount = lv_job_nr
EXCEPTIONS
cant_create_job = 1
invalid_job_data = 2
jobname_missing = 3
OTHERS = 4.
IF syst-subrc = 0.
"调用需要跑JOB的程序
SUBMIT (lv_job_name)
WITH SELECTION-TABLE lt_rspar
USER syst-uname " mandatory
VIA JOB lv_job NUMBER lv_job_nr AND RETURN.
"运行结束 关闭JOB
IF sy-subrc = 0.
CALL FUNCTION 'JOB_CLOSE'
EXPORTING
jobcount = lv_job_nr
jobname = lv_job
strtimmed = p_flag "' ' "'X:立即执行
IMPORTING
job_was_released = lv_job_released
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.
REFRESH lt_rspar.
CLEAR: lw_line,lv_job_nr.
ENDFORM.
阅读(1233) | 评论(0) | 转发(0) |