*&---------------------------------------------------------------------*
*& Report ZTHOMAS_SUBMIT_BGJOB
*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*
REPORT zthomas_submit_bgjob.
SELECTION-SCREEN BEGIN OF SCREEN 1100.
PARAMETERS: rsparams RADIOBUTTON GROUP gr1,
withexpr RADIOBUTTON GROUP gr1 .
SELECTION-SCREEN END OF SCREEN 1100.
DATA:seltab TYPE RANGE OF i ,
selection LIKE LINE OF seltab,
int TYPE i ,
rspar TYPE TABLE OF rsparams,
wa_rspar LIKE LINE OF rspar.
CALL SELECTION-SCREEN 1100 STARTING AT 10 10.
IF sy-subrc <> 0 .
RETURN.
ENDIF.
IF rsparams = 'X'.
wa_rspar-selname = 'P_EBELN'.
wa_rspar-kind = 'P'.
wa_rspar-low = '4500000009'.
APPEND wa_rspar TO rspar.
wa_rspar-selname = 'P_EBELP'.
wa_rspar-kind = 'P'.
wa_rspar-low = '10'.
APPEND wa_rspar TO rspar.
ENDIF.
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 zthomas_call_program WITH SELECTION-TABLE rspar
USER sy-uname 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.
IF sy-subrc <> 0.
...
ENDIF.
ENDIF.
ENDIF.
此例为submit调用程序直接执行后台job
其他的可以参考系统的案例DEMO_PROGRAM_SUBMIT_LINE
DEMO_PROGRAM_SUBMIT_SEL_SCREEN
阅读(408) | 评论(0) | 转发(0) |