传输请求的状态跟踪

文摘   2024-12-03 18:01   北京  

SAP的请求传输系统是一个用于将开发、测试、生产环境中的SAP对象(如ABAP程序、数据表等)从一个环境传输到另一个环境的工具。通过使用请求传输系统,用户可以在不同的SAP系统中进行协作,确保所有的环境都具有相同的开发状态和功能。

该系统的核心概念是“请求(Request)”,一个请求是包含一个或多个SAP对象的逻辑单元。用户可以在开发系统中创建请求,并通过传输工具将请求传输到其他系统。请求可以被用于许多不同的目的,例如将开发完成的代码传输到测试系统进行测试,或者将测试过的代码传输到生产系统中进行生产。

请求传输系统的使用需要一定的技术知识和经验,因此通常由专业的SAP管理员或开发人员来管理和维护。它是SAP系统中重要的组成部分,帮助企业保持高效的开发和协作。

(以上文字是AI生成的,AI果然很牛。本来吭哧瘪肚的憋不出来几句话,用AI生成就爽多了哈)

SAP的请求传输相比其他系统的版本更新机制是个很爽的存在,在不停机,不耽误应用的情况下就把版本更新了,比Java的发版不知道高级到哪儿去了。

但是SAP的请求传输管理不是太人性化,批量查看有点费劲,如果你是一个有追求的BASIS或者ABAPer,下面这个程序可能会很适合你。

选择界面:

结果展示:

挨个列双击一下,还有这些功能:

如果去掉选择界面的勾,也可以显示未释放的请求:


是不是用起来挺爽的?

代码如下:

*&---------------------------------------------------------------------**& Report  ZTRTRACE*&*&---------------------------------------------------------------------**& Baitianzhen*& 传输请求状态跟踪*&---------------------------------------------------------------------*REPORT ztrtrace NO STANDARD PAGE HEADING .
TYPE-POOLS: slis,ctslg.TABLES: e070,e07t,e070c.DATA: fldct TYPE slis_t_fieldcat_alv, slayt TYPE slis_layout_alv, varnt LIKE disvariant, repid LIKE sy-repid, datum LIKE sy-datum, tabix LIKE sy-tabix, maxrc LIKE sy-subrc.
DATA: led_gray(4) VALUE '@BZ@', led_red(4) VALUE '@5C@', led_yellow(4) VALUE '@5D@', led_green(4) VALUE '@5B@'.DATA: BEGIN OF it_out OCCURS 0, trkorr LIKE e070-trkorr, trfunction LIKE e070-trfunction, trstatus LIKE e070-trstatus, srcsystem LIKE e070-tarsystem, srclient LIKE e070c-client, tarsystem LIKE e070-tarsystem, as4user LIKE e070-as4user, as4date LIKE e070-as4date, as4text LIKE e07t-as4text, typetext TYPE seu_name, ledrel(4), ledqas(4), ledpre(4), ledsys(4), ledprd(4), viewobj(4), viewlog(4), END OF it_out.DATA: BEGIN OF it_dd07t OCCURS 0, trfunction LIKE e070-trfunction, ddtext LIKE dd07t-ddtext, END OF it_dd07t.DATA: ctsystem TYPE ctslg_system.DATA: it_comm TYPE tmscsyslst_typ WITH HEADER LINE.RANGES r_status FOR e070-trstatus.
SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE t1.SELECT-OPTIONS: s_reqst FOR e070-trkorr.SELECT-OPTIONS: s_rtext FOR e07t-as4text.SELECT-OPTIONS: s_ruser FOR e070-as4user DEFAULT sy-uname.SELECT-OPTIONS: s_srsys FOR e070-tarsystem DEFAULT sy-sysid.SELECT-OPTIONS: s_rdate FOR e070-as4date DEFAULT datum TO sy-datum.PARAMETERS: p_reled AS CHECKBOX DEFAULT 'X'.SELECTION-SCREEN END OF BLOCK b1.
SELECTION-SCREEN BEGIN OF BLOCK b2 WITH FRAME TITLE t2.PARAMETERS: p_dev TYPE sysysid DEFAULT sy-sysid OBLIGATORY.PARAMETERS: p_qas TYPE sysysid DEFAULT 'HSQ' .PARAMETERS: p_pre TYPE sysysid DEFAULT ''.PARAMETERS: p_sys TYPE sysysid DEFAULT ''.PARAMETERS: p_prd TYPE sysysid DEFAULT 'HSP' OBLIGATORY.SELECTION-SCREEN END OF BLOCK b2.
LOAD-OF-PROGRAM. datum = sy-datum - 120.
AT SELECTION-SCREEN OUTPUT. t1 = '请求选择'. t2 = '传输系统'. %_s_reqst_%_app_%-text = '请求号'. %_s_rtext_%_app_%-text = '请求描述'. %_s_ruser_%_app_%-text = '所有者'. %_s_srsys_%_app_%-text = '源系统'. %_s_rdate_%_app_%-text = '最后更改日期'. %_p_reled_%_app_%-text = '只选择已释放的请求'. %_p_dev_%_app_%-text = 'DEV系统'. %_p_qas_%_app_%-text = 'QAS系统'. %_p_pre_%_app_%-text = 'Pre.PRD'. %_p_sys_%_app_%-text = '其他系统'. %_p_prd_%_app_%-text = 'PRD系统'.
START-OF-SELECTION. PERFORM getdata. PERFORM outdata.
*&---------------------------------------------------------------------**& Form getdata*&---------------------------------------------------------------------*FORM getdata. CLEAR it_comm[]. it_comm-sysnam = p_dev. APPEND it_comm. it_comm-sysnam = p_qas. APPEND it_comm. it_comm-sysnam = p_pre. APPEND it_comm. it_comm-sysnam = p_sys. APPEND it_comm. it_comm-sysnam = p_prd. APPEND it_comm. DELETE it_comm WHERE sysnam IS INITIAL.
SELECT domvalue_l ddtext INTO TABLE it_dd07t FROM dd07t WHERE domname = 'TRFUNCTION' AND ddlanguage = sy-langu AND as4local = 'A'.
CLEAR: r_status,r_status[]. IF p_reled = 'X'. r_status-sign = 'I'. r_status-option = 'EQ'. r_status-low = 'R'. APPEND r_status. r_status-low = 'N'. APPEND r_status. ENDIF.
SELECT trkorr trfunction trstatus tarsystem as4user as4date INTO CORRESPONDING FIELDS OF TABLE it_out FROM e070 WHERE trkorr IN s_reqst AND as4user IN s_ruser AND as4date IN s_rdate AND trstatus IN r_status AND strkorr = ''. LOOP AT it_out. READ TABLE it_dd07t WITH KEY trfunction = it_out-trfunction. IF sy-subrc = 0. it_out-typetext = it_dd07t-ddtext. ENDIF.
SELECT SINGLE as4text INTO it_out-as4text FROM e07t WHERE trkorr = it_out-trkorr AND langu = sy-langu. IF sy-subrc <> 0. SELECT SINGLE as4text INTO it_out-as4text FROM e07t WHERE trkorr = it_out-trkorr . ENDIF.
SELECT SINGLE client INTO it_out-srclient FROM e070c WHERE trkorr = it_out-trkorr.
it_out-srcsystem = it_out-trkorr(3).
IF s_srsys[] IS NOT INITIAL AND it_out-srcsystem NOT IN s_srsys. DELETE it_out. CONTINUE. ENDIF.
IF s_rtext[] IS NOT INITIAL AND it_out-as4text NOT IN s_rtext. DELETE it_out. CONTINUE. ENDIF.
CASE it_out-trstatus. WHEN 'R' OR 'N'. it_out-ledrel = led_green. it_out-viewlog = '@0P@'. it_out-viewobj = '@10@'. WHEN 'O'. it_out-ledrel = led_yellow. WHEN OTHERS. it_out-ledrel = led_gray. ENDCASE.
PERFORM gettrlog CHANGING it_out.
MODIFY it_out. ENDLOOP. SORT it_out DESCENDING BY ledqas ledpre ledsys ledprd trkorr ASCENDING.ENDFORM. "getdata
*&---------------------------------------------------------------------**& Form gettrlog*&---------------------------------------------------------------------*FORM gettrlog CHANGING wa STRUCTURE it_out . DATA is_settings TYPE ctslg_settings. DATA es_cofile TYPE ctslg_cofile. DATA lt_systems TYPE ctslg_systems WITH HEADER LINE.
is_settings-point_to_missing_steps = 'X'. is_settings-detailed_depiction = 'X'.
CALL FUNCTION 'TR_READ_GLOBAL_INFO_OF_REQUEST' EXPORTING iv_trkorr = wa-trkorr is_settings = is_settings it_comm_systems = it_comm[] IMPORTING es_cofile = es_cofile. lt_systems[] = es_cofile-systems[].
PERFORM getimportrc TABLES lt_systems USING: p_qas CHANGING wa-ledqas, p_pre CHANGING wa-ledpre, p_sys CHANGING wa-ledsys, p_prd CHANGING wa-ledprd.
ENDFORM. "gettrlog
*&---------------------------------------------------------------------**& Form getrc*&---------------------------------------------------------------------*FORM getimportrc TABLES intab STRUCTURE ctsystem USING target CHANGING rc. DATA wa_step TYPE ctslg_step. DATA maxrc TYPE sy-subrc.
CHECK target IS NOT INITIAL. READ TABLE intab WITH KEY systemid = target. IF sy-subrc = 0. READ TABLE intab-steps INTO wa_step WITH KEY stepid = 'E'. IF sy-subrc <> 0. LOOP AT intab-steps INTO wa_step WHERE stepid = 'I'. tabix = sy-tabix. ENDLOOP. IF sy-subrc = 0. CLEAR maxrc. LOOP AT intab-steps INTO wa_step FROM tabix. IF wa_step-rc > maxrc. maxrc = wa_step-rc. ENDIF. ENDLOOP. CASE maxrc. WHEN 0. rc = led_green. WHEN 4 OR 6. rc = led_yellow. WHEN 8 OR 16. rc = led_red. ENDCASE. ELSE. rc = led_gray. ENDIF. ENDIF. ENDIF.ENDFORM. "getrc
*&---------------------------------------------------------------------**& Form outdata*&---------------------------------------------------------------------*FORM outdata. DATA: str(40).
slayt-colwidth_optimize = 'X'. slayt-zebra = 'X'. repid = sy-repid.
PERFORM catlg_set USING: 'TRKORR ' '' '' '请求', 'AS4TEXT ' '' '' '请求描述', 'TYPETEXT ' '' '' '请求类型', 'LEDREL ' '' '' '释放状态', 'SRCSYSTEM' '' '' '源系统', 'SRCLIENT ' '' '' '源Client', 'TARSYSTEM ' '' '' '目标系统', 'AS4USER ' '' '' '所有者', 'AS4DATE ' '' '' '最后更改日期' . IF p_qas IS NOT INITIAL. CONCATENATE p_qas '状态' INTO str. PERFORM catlg_set USING: 'LEDQAS' '' '' str. ENDIF. IF p_pre IS NOT INITIAL. CONCATENATE p_pre '状态' INTO str. PERFORM catlg_set USING: 'LEDPRE' '' '' str. ENDIF. IF p_sys IS NOT INITIAL. CONCATENATE p_sys '状态' INTO str. PERFORM catlg_set USING: 'LEDSYS' '' '' str. ENDIF. IF p_prd IS NOT INITIAL. CONCATENATE p_prd '状态' INTO str. PERFORM catlg_set USING: 'LEDPRD' '' '' str. ENDIF. PERFORM catlg_set USING: 'VIEWOBJ' '' '' '对象列表'. PERFORM catlg_set USING: 'VIEWLOG' '' '' '传输日志'.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY' EXPORTING i_callback_program = repid it_fieldcat = fldct[] i_save = 'A' is_layout = slayt i_callback_user_command = 'USER_COMMAND' TABLES t_outtab = it_out EXCEPTIONS program_error = 1 OTHERS = 2.ENDFORM. " outdata
*---------------------------------------------------------------------** FORM frm_catlg_set **---------------------------------------------------------------------*FORM catlg_set USING p_field p_reftab p_reffld p_text. DATA: ls_fldct TYPE slis_fieldcat_alv.
ls_fldct-fieldname = p_field. ls_fldct-seltext_l = p_text. ls_fldct-ddictxt = 'L'. ls_fldct-ref_fieldname = p_reffld. ls_fldct-ref_tabname = p_reftab.
IF ls_fldct-fieldname(3) = 'LED'. ls_fldct-icon = 'X'. ls_fldct-just = 'C'. ENDIF. IF ls_fldct-fieldname(4) = 'VIEW'. ls_fldct-hotspot = 'X'. ls_fldct-just = 'C'. ENDIF.
APPEND ls_fldct TO fldct . CLEAR ls_fldct .ENDFORM. "catlg_set
*&--------------------------------------------------------------------**& Form user_command*&--------------------------------------------------------------------*FORM user_command USING r_ucomm LIKE sy-ucomm rs_selfield TYPE slis_selfield. CASE r_ucomm. WHEN '&IC1'. "双击 CHECK rs_selfield-tabindex <> 0 . "小计行总计行什么的忽略 READ TABLE it_out INDEX rs_selfield-tabindex. CASE rs_selfield-fieldname. WHEN 'TRKORR' OR 'AS4TEXT'. CALL FUNCTION 'TR_PRESENT_REQUEST' EXPORTING iv_trkorr = it_out-trkorr. WHEN 'VIEWLOG'. CHECK rs_selfield-value IS NOT INITIAL. CALL FUNCTION 'TMS_UI_SHOW_TRANSPORT_LOGS' EXPORTING iv_request = it_out-trkorr EXCEPTIONS OTHERS = 1. WHEN 'VIEWOBJ'. CHECK rs_selfield-value IS NOT INITIAL. CALL FUNCTION 'TMS_UI_SHOW_TRANSPORT_REQUEST' EXPORTING iv_request = it_out-trkorr EXCEPTIONS OTHERS = 1. WHEN OTHERS. ENDCASE. ENDCASE.ENDFORM. "user_com



码农干货铺
永远要保持一种无论何时何地都逼着自己更努力更优秀来享受更好生活的学习状态
 最新文章