一:不通过SE09/10释放请求号
*&---------------------------------------------------------------------*
*& Report Z_TRANSPORT_REQUEST
*&---------------------------------------------------------------------*
*&
*&---------------------------------------------------------------------*
REPORT z_transport_request.TABLES: e070.TYPES: BEGIN OF ty_request," 请求trkorr TYPE trkorr,trans_type TYPE char1,END OF ty_request.TYPES: BEGIN OF ty_out_log," 输出日志trkorr TYPE trkorr,status TYPE char1,module TYPE char1,message TYPE text255,END OF ty_out_log.DATA:lv_falg TYPE c.* Data Definition
*&---------------------------------------------------------------------*
DATA: gt_log TYPE TABLE OF ty_out_log,gs_log TYPE ty_out_log,gt_requests TYPE TABLE OF ty_request.DATA: gv_message TYPE th_popup.CONSTANTS: gc_tms_sev_log LIKE stmsc-severity VALUE ' ',gc_tms_sev_none LIKE stmsc-severity VALUE 'N',gc_tms_sev_info LIKE stmsc-severity VALUE 'I',gc_tms_sev_error LIKE stmsc-severity VALUE 'E',gc_tms_id_no_alert LIKE stmscalert-id VALUE ' '.SELECT-OPTIONS: s_reque FOR e070-strkorr OBLIGATORY NO INTERVALS.s_reque-low = sy-sysid && '*'.
APPEND s_reque.*----------------------------------------------------------------------*
* AT SELECTION-SCREEN ON VALUE-REQUEST
*----------------------------------------------------------------------*
AT SELECTION-SCREEN ON VALUE-REQUEST FOR s_reque-low.DATA: lv_trfunctions LIKE trpari-w_longstat,lv_trstatus LIKE trpari-w_longstat,lv_trkorr TYPE e070-trkorr.lv_trkorr = s_reque-low.lv_trfunctions = 'CDEFGKMOPQRSTWX'.lv_trstatus = 'DLOR'.CALL FUNCTION 'TR_F4_REQUESTS' "TR F4 请求EXPORTINGiv_username = sy-unameiv_client = ''iv_trkorr_pattern = lv_trkorriv_trfunctions = lv_trfunctionsiv_trstatus = lv_trstatusIMPORTINGev_selected_request = lv_trkorr.s_reque-low = lv_trkorr.START-OF-SELECTION.PERFORM release_request.*&---------------------------------------------------------------------*
*& Form RELEASE_REQUEST
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM release_request .CLEAR:lv_falg.DATA: ls_request TYPE trwbo_request,lt_deleted_tasks TYPE trwbo_t_e070.DATA: lt_e070 TYPE TABLE OF e070,ls_e070 TYPE e070,ls_requests TYPE ty_request.gv_message = '1. 检查请求是否释放'.APPEND VALUE #( trkorr = '' status = 'S' module = 'H' message = gv_message ) TO gt_log." Check inputDELETE s_reque[] WHERE low CS '*'.CHECK s_reque[] IS NOT INITIAL." 子请求SELECT *FROM e070INTO TABLE lt_e070WHERE strkorr IN s_reque." Request statusIF lt_e070 IS INITIAL.MESSAGE '请输入母请求' TYPE 'E' .lv_falg = 'X'.ELSE.SELECT *FROM e070APPENDING TABLE lt_e070WHERE trkorr IN s_reque.CLEAR gt_requests.LOOP AT lt_e070 INTO ls_e070.IF ls_e070-trstatus <> 'O' AND ls_e070-trstatus <> 'R' .CALL FUNCTION 'TR_RELEASE_REQUEST'EXPORTINGiv_trkorr = ls_e070-trkorriv_dialog = ' 'iv_as_background_job = ' 'iv_success_message = 'X'iv_display_export_log = ' 'IMPORTINGes_request = ls_requestet_deleted_tasks = lt_deleted_tasksEXCEPTIONScts_initialization_failure = 1enqueue_failed = 2no_authorization = 3invalid_request = 4request_already_released = 5repeat_too_early = 6error_in_export_methods = 7object_check_error = 8docu_missing = 9db_access_error = 10action_aborted_by_user = 11export_failed = 12.IF sy-subrc = 0.ls_requests = VALUE #( trkorr = ls_e070-trkorr trans_type = '1' ).gv_message = '请求:' && ls_e070-trkorr && '成功释放'.APPEND VALUE #( trkorr = ls_e070-trkorr status = 'S' module = '1' message = gv_message ) TO gt_log.ELSE.ls_requests = VALUE #( trkorr = ls_e070-trkorr trans_type = 'E' ).gv_message = '请求:' && ls_e070-trkorr && '释放失败'.APPEND VALUE #( trkorr = ls_e070-trkorr status = 'E' module = '1' message = gv_message ) TO gt_log.READ TABLE gt_log INTO gs_log WITH KEY status = 'E'.IF sy-subrc = 0.MESSAGE gs_log-message TYPE 'S' DISPLAY LIKE 'E'.lv_falg = 'X'.EXIT.ENDIF.ENDIF.ELSE.gv_message = '请求:' && ls_e070-trkorr && '已释放'.APPEND VALUE #( trkorr = ls_e070-trkorr status = 'S' module = '1' message = gv_message ) TO gt_log.ls_requests = VALUE #( trkorr = ls_e070-trkorr trans_type = '1' ).ENDIF.IF ls_e070-strkorr IS INITIAL.APPEND ls_requests TO gt_requests.ENDIF.ENDLOOP.ENDIF.
ENDFORM
二:TMS_MGR_REFRESH_IMPORT_QUEUES 模拟STMS刷新列队
CALL FUNCTION 'TMS_MGR_REFRESH_IMPORT_QUEUES' "列队刷新模拟STMS刷新列队EXPORTINGiv_system = 'DS4' EXCEPTIONSread_config_failed = 1.