DATA: GLOBAL_JOB LIKE TBTCJOB.
DATA: GLOBAL_START_DATE LIKE TBTCSTRT.
DATA: GLOBAL_STEP_TBL LIKE TBTCSTEP OCCURS 0 WITH HEADER LINE.
DATA:TIM LIKE SY-UZEIT.
DATA:REP LIKE SY-REPID, "执行后台作业程序
VAR LIKE RALDB-VARIANT. "执行变式
GET TIME.
TIM = SY-UZEIT + 120. "系统当期时间后2分钟
GLOBAL_JOB-JOBNAME = 'ZFI_IFMIS002'. "作业名
GLOBAL_JOB-SDLSTRTDT = SY-DATUM. "作业开始日期
GLOBAL_JOB-SDLSTRTTM = TIM. "作业开始时间
GLOBAL_JOB-JOBCLASS = 'A'.
GLOBAL_JOB-NEWFLAG = 'O'.
GLOBAL_JOB-SDLUNAME = SY-UNAME.
GLOBAL_STEP_TBL-PROGRAM = 'ZFI_IFMIS002'.
GLOBAL_STEP_TBL-TYP = 'A'.
GLOBAL_STEP_TBL-STATUS = 'P'.
GLOBAL_STEP_TBL-AUTHCKNAM = SY-UNAME.
APPEND GLOBAL_STEP_TBL.
REP = 'ZFI_IFMIS002'.
VAR = '2000'.
*定义后台作业
CALL FUNCTION 'BP_JOB_CREATE'
EXPORTING
JOB_CR_DIALOG = 'N'
JOB_CR_HEAD_INP = GLOBAL_JOB
IMPORTING
JOB_CR_HEAD_OUT = GLOBAL_JOB
JOB_CR_STDT_OUT = GLOBAL_START_DATE
TABLES
JOB_CR_STEPLIST = GLOBAL_STEP_TBL
EXCEPTIONS
CANT_CREATE_JOB = 1
INVALID_DIALOG_TYPE = 2
INVALID_JOB_DATA = 3
JOB_CREATE_CANCELED = 4
OTHERS = 5.
*执行后台作业
CALL FUNCTION 'JOB_SUBMIT'
EXPORTING
AUTHCKNAM = SY-UNAME
JOBCOUNT = GLOBAL_JOB-JOBCOUNT
JOBNAME = GLOBAL_JOB-JOBNAME
REPORT = REP
VARIANT = VAR.
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/11671405/viewspace-432980/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/11671405/viewspace-432980/