"创建后台JOB,调用ZPPR0010_C
DATA: lv_jobname TYPE tbtcjob-jobname,
lv_jobcount TYPE tbtcjob-jobcount.
lv_jobname = sy-datum && sy-uzeit && '_' && 'ZPPR0010' && '_' && sy-uname.
CALL FUNCTION 'JOB_OPEN'
EXPORTING
jobname = lv_jobname
IMPORTING
jobcount = lv_jobcount
EXCEPTIONS
cant_create_job = 1
invalid_job_data = 2
jobname_missing = 3
OTHERS = 4.
IF sy-subrc = 0.
DATA: lt_rsparams LIKE TABLE OF rsparams,
ls_rsparams LIKE rsparams.
LOOP AT s_pcode.
MOVE-CORRESPONDING s_pcode TO ls_rsparams.
ls_rsparams-selname = 'S_PCODE'.
ls_rsparams-kind = 'S'.
APPEND ls_rsparams TO lt_rsparams.
CLEAR ls_rsparams.
ENDLOOP.
SUBMIT zppr0010_c WITH SELECTION-TABLE lt_rsparams
VIA JOB lv_jobname
NUMBER lv_jobcount
AND RETURN.
IF sy-subrc = 0.
CALL FUNCTION 'JOB_CLOSE'
EXPORTING
jobcount = lv_jobcount
jobname = lv_jobname
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 EQ 0.
MESSAGE s715(db) WITH lv_jobname.
LEAVE TO SCREEN 0.
ENDIF.
ELSE.
DATA(msg) = cl_abap_submit_handling=>get_error_message( ).
MESSAGE ID msg-msgid
TYPE 'I'
NUMBER msg-msgno
WITH msg-msgv1 msg-msgv2 msg-msgv3 msg-msgv4
DISPLAY LIKE msg-msgty.
ENDIF.
ENDIF.
ABAP程序实现后台JOB
最后编辑于 :
©著作权归作者所有,转载或内容合作请联系作者
- 文/潘晓璐 我一进店门,熙熙楼的掌柜王于贵愁眉苦脸地迎上来,“玉大人,你说我怎么就摊上这事。” “怎么了?”我有些...
- 文/花漫 我一把揭开白布。 她就那样静静地躺着,像睡着了一般。 火红的嫁衣衬着肌肤如雪。 梳的纹丝不乱的头发上,一...
- 文/苍兰香墨 我猛地睁开眼,长吁一口气:“原来是场噩梦啊……” “哼!你这毒妇竟也来了?” 一声冷哼从身侧响起,我...