如何用程序提交后台作业

DATA: number

TYPE tbtcjob-jobcount,

name

TYPE tbtcjob-jobname VALUE ‘JOB_TEST’,

print_parameters TYPE pri_params.

CALL FUNCTION ‘JOB_OPEN’
EXPORTING

jobname

= name
IMPORTING

jobcount

= number
EXCEPTIONS

cant_create_job
= 1

invalid_job_data = 2

jobname_missing
= 3

OTHERS

= 4.
IF sy-subrc = 0.
SUBMIT submitable TO SAP-SPOOL

SPOOL PARAMETERS print_parameters

WITHOUT SPOOL DYNPRO

VIA JOB name NUMBER number

AND RETURN.
IF sy-subrc = 0.
* 定时后台

CALL FUNCTION ‘JOB_CLOSE’

EXPORTING

jobcount

= number

jobname

= 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.

* 前置job完成后开始的后台

CALL FUNCTION ‘JOB_CLOSE’

EXPORTING

jobcount

= job_number

jobname

= job_name

pred_jobcount

= it_job-job_number

pred_jobname

= it_job-job_name

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.

IF sy-subrc <> 0.

ENDIF.
ENDIF.
ENDIF.

Comments are closed.