实现效果
不用释放请求,可以把对方对象从DEV直接释放到目标系统中
表对象设计
表结构设计
1. ZSAB0007 Develop toolset: current working objects
2. Structure:ZSAB0008 发版计划请求列表
3. ZSAB0022 Development objects - object search results
程序设计
Function Group: SAPLZAB_FG14
*******************************************************************
* System-defined Include-files. *
*******************************************************************
INCLUDE lzab_fg14top. " Global Declarations
INCLUDE lzab_fg14uxx. " Function Modules
*******************************************************************
* User-defined Include-files (if necessary). *
*******************************************************************
* INCLUDE LZAB_FG14F... " Subroutines
* INCLUDE LZAB_FG14O... " PBO-Modules
* INCLUDE LZAB_FG14I... " PAI-Modules
* INCLUDE LZAB_FG14E... " Events
* INCLUDE LZAB_FG14P... " Local class implement.
* INCLUDE LZAB_FG14T99. " ABAP Unit tests
INCLUDE lzab_fg14o01.
INCLUDE lzab_fg14i01.
INCLUDE lzab_fg14o02.
INCLUDE lzab_fg14f01.
INCLUDE lzab_fg14i02.
INCLUDE zab_fg14c01i.
Include LZAB_FG14TOP
FUNCTION-POOL zab_fg14. "MESSAGE-ID ..
TABLES:
usr01.
TYPES:
tt_ab0007 TYPE STANDARD TABLE OF zsab0007 WITH DEFAULT KEY,
tt_ab0008 TYPE STANDARD TABLE OF zsab0008 WITH DEFAULT KEY,
tt_ab0022 TYPE STANDARD TABLE OF zsab0022 WITH DEFAULT KEY.
CONSTANTS:
c_red TYPE char10 VALUE icon_led_red,
c_green TYPE char10 VALUE icon_led_green,
c_yellow TYPE char10 VALUE icon_led_yellow,
c_dummy TYPE char10 VALUE icon_dummy.
INCLUDE zab_fg14c01.
* INCLUDE LZAB_FG14D... " Local class definition
DATA:
" data model - current working source code objects
gt_current_obj TYPE tt_ab0007,
go_current_obj TYPE REF TO lcl_current_obj,
gt_tr TYPE tt_ab0008,
go_tr TYPE REF TO lcl_tr,
gt_ztab0023_db TYPE TABLE OF ztab0023, " Data table to be save to DB
gt_search TYPE tt_ab0022,
go_search TYPE REF TO lcl_search,
g_filename TYPE string,
g_system_cate TYPE char1, " D / Q / P
" TR list for EXCEL
go_document_tr TYPE REF TO i_oi_document_proxy,
go_sheet_tr TYPE REF TO i_oi_spreadsheet,
g_prop_value_tr TYPE bds_propva , " DOI EXCEL模板文档的关键字标签, 与TCODE相同
g_application_name_tr TYPE text255, " 默认文件名
" ALVs
" ALV-current working objects
go_cont_current_obj TYPE REF TO cl_gui_custom_container,
gs_layout_current_obj TYPE lvc_s_layo,
gt_fieldcat_current_obj TYPE lvc_t_fcat,
grid_current_obj TYPE REF TO cl_gui_alv_grid,
go_events_current_obj TYPE REF TO lcl_current_obj_evt,
" ALV-current Transport requests
go_cont_current_tr TYPE REF TO cl_gui_custom_container,
gs_layout_tr TYPE lvc_s_layo,
gt_fieldcat_tr TYPE lvc_t_fcat,
grid_tr TYPE REF TO cl_gui_alv_grid,
go_events_tr TYPE REF TO lcl_tr_evt,
" ALV -search objects
go_cont_current_search TYPE REF TO cl_gui_custom_container,
gs_layout_search TYPE lvc_s_layo,
gt_fieldcat_search TYPE lvc_t_fcat,
grid_search TYPE REF TO cl_gui_alv_grid,
go_events_search TYPE REF TO lcl_search_evt,
go_dock TYPE REF TO cl_gui_docking_container,
" object search
g_search_string TYPE text100,
gt_find_list TYPE TABLE OF rsfindlst, " where use list result
" " " Screen data elements
g_init_8200 TYPE abap_bool,
save_ok TYPE syucomm,
ok_code TYPE syucomm,
" search pattern
BEGIN OF gs_search_option,
only_z TYPE xfeld VALUE 'X', " only search Z*/Y*
no_local TYPE xfeld VALUE 'X', " Without local objects
t100 TYPE xfeld, " SE91 messages
data_elem TYPE xfeld,
domain TYPE xfeld,
method TYPE xfeld,
END OF gs_search_option,
" tabstrips
BEGIN OF tab_workplace,
prog TYPE syrepid VALUE sy-repid,
dynr TYPE sydynnr VALUE 8201,
END OF tab_workplace,
go_splitter_main TYPE REF TO cl_gui_splitter_container,
go_splitter_top TYPE REF TO cl_gui_splitter_container,
go_splitter_top_left TYPE REF TO cl_gui_container,
go_splitter_top_right TYPE REF TO cl_gui_container,
go_splitter_bottom TYPE REF TO cl_gui_splitter_container,
go_splitter_bottom_left TYPE REF TO cl_gui_container,
go_splitter_bottom_right TYPE REF TO cl_gui_container,
g_splitposx TYPE i,
g_splitpos_main TYPE i,
g_splitpos_top TYPE i,
g_splitpos_bottom TYPE i,
go_split_main TYPE REF TO cl_dynpro_splitter,
go_split_top TYPE REF TO cl_dynpro_splitter,
go_split_bottom TYPE REF TO cl_dynpro_splitter.
CONTROLS:
ts_dev TYPE TABSTRIP.
Include ZAB_FG14C01
*&---------------------------------------------------------------------*
*& 包含 ZAB_FG14C01
*&---------------------------------------------------------------------*
" class model for : current working program/source code
CLASS lcl_current_obj DEFINITION.
PUBLIC SECTION.
METHODS:
get_dev_obj RETURNING VALUE(rt_dev_obj) TYPE tt_ab0007,
get_data IMPORTING i_uname TYPE syuname,
constructor IMPORTING i_uname TYPE syuname DEFAULT sy-uname i_refresh TYPE abap_bool DEFAULT abap_false.
PRIVATE SECTION.
DATA:
mt_dev_obj TYPE tt_ab0007.
ENDCLASS.
" event handler class for : current working program/source code
CLASS lcl_current_obj_evt DEFINITION INHERITING FROM zcl_common.
PUBLIC SECTION.
METHODS:
user_command REDEFINITION,
button_click REDEFINITION,
handle_double_click REDEFINITION,
toolbar REDEFINITION.
ENDCLASS.
" class model for : current working transport requests
CLASS lcl_tr DEFINITION.
PUBLIC SECTION.
METHODS:
get_tr RETURNING VALUE(rt_tr) TYPE tt_ab0008,
get_data IMPORTING i_uname TYPE syuname,
check_tr_version,
constructor IMPORTING i_uname TYPE syuname DEFAULT sy-uname i_refresh TYPE abap_bool DEFAULT abap_false.
PRIVATE SECTION.
DATA:
mt_tr TYPE tt_ab0008.
ENDCLASS.
" event handler class for : current working transport requests
CLASS lcl_tr_evt DEFINITION INHERITING FROM zcl_common.
PUBLIC SECTION.
METHODS:
user_command REDEFINITION,
button_click REDEFINITION,
data_changed REDEFINITION,
handle_double_click REDEFINITION,
toolbar REDEFINITION.
ENDCLASS.
CLASS lcl_assist DEFINITION.
PUBLIC SECTION.
CLASS-METHODS:
" source code related methods
code_sync IMPORTING it_rows TYPE lvc_t_roid i_rfc TYPE rfcdest EXPORTING e_objname TYPE string,
" TR related methods
tr_excel_doi,
tr_transport_info IMPORTING i_trkorr TYPE trkorr i_sys TYPE char01 RETURNING VALUE(rs_cofile) TYPE ctslg_cofile,
tr_transport_log IMPORTING i_trkorr TYPE trkorr i_sys TYPE char01 RETURNING VALUE(rs_tmstpalog) TYPE tmstpalog,
tr_popup_filter CHANGING ct_filter TYPE tmsiqfils, " call function TMS_UIQ_INT_POPUP_FILTER to popup select TR list
tr_compress IMPORTING i_trkorr TYPE trkorr,
tr_release IMPORTING i_trkorr TYPE trkorr.
PRIVATE SECTION.
ENDCLASS.
CLASS lcl_pai DEFINITION.
PUBLIC SECTION.
CLASS-METHODS:
tr_download ,
tr_switch_usr,
press_enter,
search_objects,
download_where_use,
leave,
flyback,
tr_check_version,
_on_okcode IMPORTING i_saveok TYPE syucomm.
PRIVATE SECTION.
CLASS-METHODS:
notification IMPORTING i_type TYPE csequence.
CLASS-DATA:
m_dynamic_search TYPE string .
* save_ok TYPE syucomm.
ENDCLASS.
CLASS lcl_search DEFINITION.
PUBLIC SECTION.
CLASS-METHODS:
search_t100 IMPORTING i_sstring TYPE text100,
search_data_elem IMPORTING i_sstring TYPE text100,
search_method IMPORTING i_sstring TYPE text100.
CLASS-DATA:
s_dyn_cond TYPE string.
PRIVATE SECTION.
ENDCLASS.
CLASS lcl_search_evt DEFINITION INHERITING FROM zcl_common.
PUBLIC SECTION.
METHODS:
user_command REDEFINITION,
menu_button REDEFINITION,
button_click REDEFINITION,
toolbar REDEFINITION.
PRIVATE SECTION.
ENDCLASS.
ZAB_FG14C01I
*&---------------------------------------------------------------------*
*& 包含 ZAB_FG14C01I
*&---------------------------------------------------------------------*
CLASS lcl_current_obj IMPLEMENTATION.
METHOD constructor.
get_data( i_uname = i_uname ).
ENDMETHOD.
METHOD get_data.
DATA:
l_datum TYPE d.
l_datum = sy-datum - 60.
SELECT
progname
unam
udat
utime
INTO CORRESPONDING FIELDS OF TABLE mt_dev_obj
FROM reposrc " trdir
WHERE unam = i_uname
AND udat >= l_datum.
SORT mt_dev_obj BY udat DESCENDING utime DESCENDING.
" filter out the common include program of the class.
LOOP AT mt_dev_obj ASSIGNING FIELD-SYMBOL(<fs_obj>) WHERE progname CS '=' AND progname NP '*=CM*'.
CLEAR : <fs_obj>-progname .
ENDLOOP.
DELETE mt_dev_obj WHERE progname IS INITIAL.
LOOP AT mt_dev_obj ASSIGNING <fs_obj>.
<fs_obj>-btn_version = icon_history.
<fs_obj>-btn_edit_source = icon_change.
ENDLOOP.
ENDMETHOD.
METHOD get_dev_obj.
rt_dev_obj = mt_dev_obj.
ENDMETHOD.
ENDCLASS.
CLASS lcl_current_obj_evt IMPLEMENTATION.
METHOD user_command.
CALL METHOD grid_current_obj->get_selected_rows
IMPORTING
* et_index_rows =
et_row_no = DATA(lt_rows).
CASE e_ucomm.
WHEN 'SYNCQ'.
zcl_ab_user_behaviour=>collect_start( VALUE ztab1129( zmodule = 'AB' app_id = 'ABDT01' action = 'SYNCQ' ) ).
lcl_assist=>code_sync( EXPORTING it_rows = lt_rows i_rfc = 'EQ1-360' IMPORTING e_objname = DATA(l_objnames) ).
zcl_ab_user_behaviour=>collect_end( VALUE ztab1129( docnr = l_objnames ) ).
WHEN 'SYNCED2'.
lcl_assist=>code_sync( EXPORTING it_rows = lt_rows i_rfc = 'ED2' ).
WHEN 'Q' OR 'P'. " compare source code between different systems
LOOP AT lt_rows ASSIGNING FIELD-SYMBOL(<fs_row>).
READ TABLE gt_current_obj ASSIGNING FIELD-SYMBOL(<fs_obj>) INDEX <fs_row>-row_id.
IF sy-subrc = 0.
CALL FUNCTION 'ZAB_COMPARE_CODE'
EXPORTING
i_prog1 = <fs_obj>-progname
* I_PROG2 =
i_sys = CONV char1( e_ucomm ).
ENDIF.
ENDLOOP.
WHEN 'REFRESH'.
go_current_obj->get_data( i_uname = sy-uname ).
gt_current_obj = go_current_obj->get_dev_obj( ).
grid_current_obj->refresh_table_display( ).
WHEN 'OTHER'.
CALL SCREEN 8301 STARTING AT 5 5 ENDING AT 50 12 .
ENDCASE.
ENDMETHOD.
METHOD toolbar .
DATA: ls_toolbar TYPE stb_button.
CLEAR ls_toolbar.
MOVE 'REFRESH' TO ls_toolbar-function.
MOVE 'Refresh' TO ls_toolbar-quickinfo.
MOVE icon_refresh TO ls_toolbar-icon.
MOVE 'Refresh' TO ls_toolbar-text.
MOVE '' TO ls_toolbar-disabled.
APPEND ls_toolbar TO e_object->mt_toolbar.
CLEAR ls_toolbar.
MOVE 'SYNCQ' TO ls_toolbar-function.
MOVE 'SyncQ' TO ls_toolbar-quickinfo.
MOVE icon_import_transport_request TO ls_toolbar-icon.
MOVE 'SyncQ' TO ls_toolbar-text.
MOVE '' TO ls_toolbar-disabled.
APPEND ls_toolbar TO e_object->mt_toolbar.
IF sy-uname = 'YANCT01'.
CLEAR ls_toolbar.
MOVE 'SYNCED2' TO ls_toolbar-function.
MOVE 'SyncED2' TO ls_toolbar-quickinfo.
MOVE icon_import_transport_request TO ls_toolbar-icon.
MOVE 'SyncED2' TO ls_toolbar-text.
MOVE '' TO ls_toolbar-disabled.
APPEND ls_toolbar TO e_object->mt_toolbar.
CLEAR ls_toolbar.
MOVE 'OTHER' TO ls_toolbar-function.
MOVE 'Other Developer' TO ls_toolbar-quickinfo.
MOVE icon_other_object TO ls_toolbar-icon.
MOVE 'OtherDev' TO ls_toolbar-text.
MOVE '' TO ls_toolbar-disabled.
APPEND ls_toolbar TO e_object->mt_toolbar.
ENDIF.
IF sy-sysid+0(2) = 'ED'. " development system
CLEAR ls_toolbar.
MOVE 'Q' TO ls_toolbar-function.
MOVE 'CompQ' TO ls_toolbar-quickinfo.
MOVE icon_compare TO ls_toolbar-icon.
MOVE 'CompQ' TO ls_toolbar-text.
MOVE '' TO ls_toolbar-disabled.
APPEND ls_toolbar TO e_object->mt_toolbar.
ENDIF.
IF sy-sysid+0(2) = 'ED' " development or quality system
OR sy-sysid+0(2) = 'EQ'.
CLEAR ls_toolbar.
MOVE 'P' TO ls_toolbar-function.
MOVE 'CompP' TO ls_toolbar-quickinfo.
MOVE icon_compare TO ls_toolbar-icon.
MOVE 'CompP' TO ls_toolbar-text.
MOVE '' TO ls_toolbar-disabled.
APPEND ls_toolbar TO e_object->mt_toolbar.
ENDIF.
ENDMETHOD.
METHOD button_click . " ALV button column click handler
DATA:
ls_tadir TYPE tadir.
READ TABLE gt_current_obj ASSIGNING FIELD-SYMBOL(<fs_obj>) INDEX es_row_no-row_id.
IF sy-subrc = 0.
CASE es_col_id-fieldname.
WHEN 'BTN_EDIT_SOURCE'.
CALL FUNCTION 'EDITOR_PROGRAM'
EXPORTING
appid = 'PG'
display = ''
program = <fs_obj>-progname
* line = <fs_hardcode>-line
* topline = <fs_hardcode>-line
EXCEPTIONS
OTHERS = 0.
grid_current_obj->set_selected_rows( it_index_rows = VALUE #( ( index = es_row_no-row_id ) ) ).
WHEN 'BTN_VERSION'.
* SELECT SINGLE pgmid object INTO CORRESPONDING FIELDS OF ls_tadir
* FROM tadir
* WHERE obj_name = <fs_obj>-progname.
* IF sy-subrc = 0.
CALL FUNCTION 'SVRS_DISPLAY_VERSION'
EXPORTING
pgmid = 'R3TR' " ls_tadir-pgmid
object = 'REPS' " ls_tadir-object
obj_name = CONV trobj_name( <fs_obj>-progname )
process_import = 'X'.
* ENDIF.
* WHEN .
ENDCASE.
ENDIF.
ENDMETHOD.
METHOD handle_double_click.
READ TABLE gt_current_obj ASSIGNING FIELD-SYMBOL(<fs_obj>) INDEX e_row-index.
IF sy-subrc = 0.
CASE e_column-fieldname.
WHEN 'PROGNAME'.
CALL FUNCTION 'EDITOR_PROGRAM'
EXPORTING
appid = 'PG'
display = 'X'
program = <fs_obj>-progname
* line = <fs_hardcode>-line
* topline = <fs_hardcode>-line
EXCEPTIONS
OTHERS = 0.
ENDCASE.
ENDIF.
ENDMETHOD.
ENDCLASS.
CLASS lcl_tr IMPLEMENTATION.
METHOD get_tr.
rt_tr = mt_tr.
ENDMETHOD.
method check_tr_version.
" 显示指定请求的详细对象清单,可用于传输前检查,多个传输请求之间的依赖及冲突管理
" 弹出请求筛选对话框
* LCL_ASSIST=>TR_POPUP_FILTER( ).
" 根据指定的请求,获取详细信息
" 以列表展示详细信息
endmethod.
METHOD get_data.
DATA:
l_rc TYPE trretcode.
SELECT a~*, b~as4text
INTO CORRESPONDING FIELDS OF TABLE @mt_tr
FROM e070 AS a
INNER JOIN e07t AS b
ON b~trkorr = a~trkorr
WHERE as4user = @i_uname
AND ( trfunction = 'K' OR trfunction = 'W' )
.
SORT mt_tr BY as4date DESCENDING as4time DESCENDING.
LOOP AT mt_tr ASSIGNING FIELD-SYMBOL(<fs_tr>).
<fs_tr>-btn_create_tr = icon_create.
" get transport log and set icon according to log result, >> show this information on demand
* IF <fs_tr>-trstatus = 'R'.
* IF sy-datum - <fs_tr>-as4date < 30.
*
** DATA(l_rc) = lcl_assist=>tr_transport_info( i_trkorr = <fs_tr>-trkorr i_sys = 'Q' )-rc.
* l_rc = lcl_assist=>tr_transport_log( i_trkorr = <fs_tr>-trkorr i_sys = 'Q' )-retcode.
* <fs_tr>-btn_log_q = SWITCH #(
* l_rc WHEN '0000' THEN c_green
* WHEN '0004' THEN c_yellow
* WHEN '0008' THEN c_red
* ELSE c_dummy )
* .
*
** l_rc = lcl_assist=>tr_transport_log( i_trkorr = <fs_tr>-trkorr i_sys = 'T' )-RETCODE.
* <fs_tr>-btn_log_t = SWITCH #(
* l_rc WHEN '0000' THEN c_green
* WHEN '0004' THEN c_yellow
* WHEN '0008' THEN c_red
* ELSE c_dummy )
* .
** l_rc = lcl_assist=>tr_transport_log( i_trkorr = <fs_tr>-trkorr i_sys = 'P' )-RETCODE.
* <fs_tr>-btn_log_p = SWITCH #(
* l_rc WHEN '0000' THEN c_green
* WHEN '0004' THEN c_yellow
* WHEN '0008' THEN c_red
* ELSE c_dummy )
* .
*
* ENDIF.
* ENDIF.
ENDLOOP.
ENDMETHOD.
METHOD constructor.
get_data( i_uname = i_uname ).
ENDMETHOD.
ENDCLASS.
CLASS lcl_tr_evt IMPLEMENTATION.
METHOD toolbar .
DATA: ls_toolbar TYPE stb_button.
CLEAR ls_toolbar.
MOVE 'REFRESH' TO ls_toolbar-function.
MOVE 'Refresh' TO ls_toolbar-quickinfo.
MOVE icon_refresh TO ls_toolbar-icon.
MOVE 'Refresh' TO ls_toolbar-text.
MOVE '' TO ls_toolbar-disabled.
APPEND ls_toolbar TO e_object->mt_toolbar.
" " download selected TR according the release TR list template
* CLEAR ls_toolbar.
* MOVE 'SAVE' TO ls_toolbar-function.
* MOVE 'Save' TO ls_toolbar-quickinfo.
* MOVE icon_export TO ls_toolbar-icon.
* MOVE 'Save' TO ls_toolbar-text.
* MOVE '' TO ls_toolbar-disabled.
* APPEND ls_toolbar TO e_object->mt_toolbar.
* CLEAR ls_toolbar.
* MOVE 'FULLSCREEN' TO ls_toolbar-function.
* MOVE 'FullScreen' TO ls_toolbar-quickinfo.
* MOVE icon_view_maximize TO ls_toolbar-icon.
* MOVE 'FullScreen' TO ls_toolbar-text.
* APPEND ls_toolbar TO e_object->mt_toolbar.
IF g_system_cate = 'D'. " development system
CLEAR ls_toolbar.
MOVE 'COMPRESS' TO ls_toolbar-function.
MOVE 'COMPRESS' TO ls_toolbar-quickinfo.
MOVE icon_compare TO ls_toolbar-icon.
* MOVE 'Download' TO ls_toolbar-text.
APPEND ls_toolbar TO e_object->mt_toolbar.
CLEAR ls_toolbar.
MOVE 'RELEASE' TO ls_toolbar-function.
MOVE icon_transport TO ls_toolbar-icon.
APPEND ls_toolbar TO e_object->mt_toolbar.
ENDIF.
IF g_system_cate = 'Q'. " quality system.
CLEAR ls_toolbar.
MOVE 'IMPORT' TO ls_toolbar-function.
MOVE icon_import_transport_request TO ls_toolbar-icon.
APPEND ls_toolbar TO e_object->mt_toolbar.
ENDIF.
CLEAR ls_toolbar.
MOVE 'COPYTR' TO ls_toolbar-function.
MOVE icon_copy_object TO ls_toolbar-icon.
MOVE 'Put TR info. into clipboard' TO ls_toolbar-quickinfo.
APPEND ls_toolbar TO e_object->mt_toolbar.
ENDMETHOD.
METHOD data_changed.
LOOP AT er_data_changed->mt_good_cells ASSIGNING FIELD-SYMBOL(<fs_cell>). "collect the changed data into DB itab, prepare for saving data to DB later
READ TABLE gt_tr ASSIGNING FIELD-SYMBOL(<fs_tr>)
INDEX <fs_cell>-row_id.
IF sy-subrc = 0.
READ TABLE gt_ztab0023_db ASSIGNING FIELD-SYMBOL(<fs_ab23>) WITH KEY trkorr = <fs_tr>-trkorr.
IF sy-subrc = 0.
MOVE-CORRESPONDING <fs_tr> TO <fs_ab23>.
ELSE.
APPEND INITIAL LINE TO gt_ztab0023_db ASSIGNING <fs_ab23>.
MOVE-CORRESPONDING <fs_tr> TO <fs_ab23>.
ENDIF.
ENDIF.
ENDLOOP.
ENDMETHOD.
METHOD user_command.
DATA:
l_rc TYPE i,
ls_exceptions TYPE stmscalert.
* lt_source TYPE copc_t_remark_detail.
CALL METHOD grid_tr->get_selected_rows
IMPORTING
* et_index_rows =
et_row_no = DATA(lt_rows).
CASE e_ucomm.
WHEN 'REFRESH'.
go_tr->get_data( i_uname = sy-uname ).
gt_tr = go_tr->get_tr( ).
grid_tr->refresh_table_display( ).
WHEN 'SAVE'.
IF gt_ztab0023_db IS NOT INITIAL.
MODIFY ztab0023 FROM TABLE gt_ztab0023_db.
CLEAR: gt_ztab0023_db[].
ENDIF.
WHEN 'FULLSCREEN'.
go_splitter_main->set_row_height( id = 2 height = 0 ).
go_splitter_top->set_column_width( id = 1 width = 0 ).
WHEN 'COMPRESS'.
zcl_fi_utility=>sapgui_progress_indicator( iv_percentage = 0 iv_text = TEXT-t01 ).
LOOP AT lt_rows ASSIGNING FIELD-SYMBOL(<fs_row>).
READ TABLE gt_tr ASSIGNING FIELD-SYMBOL(<fs_tr>) INDEX <fs_row>-row_id.
IF sy-subrc = 0.
lcl_assist=>tr_compress( <fs_tr>-trkorr ).
ENDIF.
ENDLOOP.
" release the TR into the transportation queue
WHEN 'RELEASE'.
zcl_fi_utility=>sapgui_progress_indicator( iv_percentage = 0 iv_text = TEXT-t02 ).
LOOP AT lt_rows ASSIGNING <fs_row>.
READ TABLE gt_tr ASSIGNING <fs_tr> INDEX <fs_row>-row_id.
IF sy-subrc = 0.
" get tasks under the TR
SELECT trkorr INTO TABLE @DATA(lt_task) FROM e070 WHERE strkorr = @<fs_tr>-trkorr AND trstatus = 'D'.
LOOP AT lt_task ASSIGNING FIELD-SYMBOL(<fs_task>).
" release all the tasks
lcl_assist=>tr_release( <fs_task>-trkorr ).
ENDLOOP.
" release the TR itself.
lcl_assist=>tr_release( <fs_tr>-trkorr ).
IF sy-subrc = 0.
<fs_tr>-trstatus = 'R'.
ENDIF.
ENDIF.
ENDLOOP.
grid_tr->refresh_table_display( is_stable = CONV #( '##' ) ).
" import the selected TR into current system
WHEN 'IMPORT'.
DATA:
ls_tp_trque TYPE stms_tp_trque,
lt_logptr TYPE TABLE OF tplogptr,
lt_stdout TYPE TABLE OF tpstdout,
lt_request TYPE stms_tr_requests,
l_trkorr TYPE e070-trkorr,
lt_val TYPE ui_yt_sval.
APPEND INITIAL LINE TO lt_val ASSIGNING FIELD-SYMBOL(<fs_val>).
<fs_val>-tabname = 'E070'.
<fs_val>-fieldname = 'TRKORR'.
CALL METHOD zcl_ca=>popup_get_values
EXPORTING
* iv_no_value_check =
iv_title = 'Input TR..'
CHANGING
ct_value = lt_val
RECEIVING
r_rc = DATA(l_rc1).
READ TABLE lt_val ASSIGNING <fs_val> INDEX 1.
IF sy-subrc = 0 AND <fs_val>-value IS NOT INITIAL.
l_trkorr = <fs_val>-value.
CALL FUNCTION 'ZTR_REQUEST_IMPORT'
EXPORTING
iv_request = l_trkorr
TABLES
tt_logptr = lt_logptr
tt_stdout = lt_stdout.
ENDIF.
WHEN 'COPYTR'.
DATA:
lt_data TYPE TABLE OF text100.
LOOP AT lt_rows ASSIGNING <fs_row>.
READ TABLE gt_tr ASSIGNING <fs_tr> INDEX <fs_row>-row_id.
IF sy-subrc = 0.
APPEND <fs_tr>-trkorr && ` ` && <fs_tr>-as4user && ` ` && <fs_tr>-as4text && cl_abap_char_utilities=>cr_lf TO lt_data.
ENDIF.
ENDLOOP.
cl_gui_frontend_services=>clipboard_export( IMPORTING data = lt_data CHANGING rc = l_rc ).
ENDCASE.
ENDMETHOD.
METHOD button_click . " ALV button column click handler
DATA:
ls_tr_header TYPE trwbo_request_header.
READ TABLE gt_tr ASSIGNING FIELD-SYMBOL(<fs_tr>) INDEX es_row_no-row_id.
IF sy-subrc = 0.
CASE es_col_id-fieldname.
WHEN 'BTN_CREATE_TR'.
DATA(lt_users) = VALUE trwbo_users( ( user = sy-uname ) ). " scts_users
CALL FUNCTION 'TR_REQUEST_MODIFY'
EXPORTING
iv_action = 'CREA'
iv_new_request_type = <fs_tr>-trfunction
iv_new_tarsystem = <fs_tr>-tarsystem
iv_new_as4text = <fs_tr>-as4text
it_users = lt_users
IMPORTING
es_new_request = ls_tr_header
EXCEPTIONS
cancelled_by_user = 1
no_authorization = 2
invalid_action = 3
invalid_request = 4
invalid_request_type = 5
request_not_created = 6
request_not_deleted = 7
enqueue_failed = 8
db_access_error = 9
OTHERS = 10.
IF sy-subrc <> 0.
* Implement suitable error handling here
ELSE.
INSERT INITIAL LINE INTO gt_tr INDEX 1 ASSIGNING FIELD-SYMBOL(<fs_tr_new>).
MOVE-CORRESPONDING ls_tr_header TO <fs_tr_new>.
<fs_tr_new>-btn_create_tr = icon_create.
ENDIF.
WHEN 'BTN_LOG_Q'.
IF <fs_tr>-trstatus = 'R'.
IF <fs_tr>-btn_log_q IS INITIAL.
DATA(l_rc) = lcl_assist=>tr_transport_log( i_trkorr = <fs_tr>-trkorr i_sys = 'Q' )-retcode.
<fs_tr>-btn_log_q = SWITCH #(
l_rc WHEN '0000' THEN c_green
WHEN '0004' THEN c_yellow
WHEN '0008' THEN c_red
ELSE c_dummy ).
ENDIF.
ENDIF.
IF <fs_tr>-btn_log_q IS NOT INITIAL AND <fs_tr>-btn_log_q <> c_dummy.
CALL FUNCTION 'TMS_UI_SHOW_TRANSPORT_LOGS'
EXPORTING
iv_request = <fs_tr>-trkorr
iv_system = 'EQ1'.
IF sy-subrc <> 0.
* Implement suitable error handling here
ENDIF.
ENDIF.
WHEN 'BTN_LOG_T'.
IF <fs_tr>-trstatus = 'R'.
IF <fs_tr>-btn_log_t IS INITIAL.
l_rc = lcl_assist=>tr_transport_log( i_trkorr = <fs_tr>-trkorr i_sys = 'T' )-retcode.
<fs_tr>-btn_log_t = SWITCH #(
l_rc WHEN '0000' THEN c_green
WHEN '0004' THEN c_yellow
WHEN '0008' THEN c_red
ELSE c_dummy ).
ENDIF.
ENDIF.
IF <fs_tr>-btn_log_t IS NOT INITIAL AND <fs_tr>-btn_log_t <> c_dummy.
CALL FUNCTION 'TMS_UI_SHOW_TRANSPORT_LOGS'
EXPORTING
iv_request = <fs_tr>-trkorr
iv_system = 'ET1'.
IF sy-subrc <> 0.
* Implement suitable error handling here
ENDIF.
ENDIF.
WHEN 'BTN_LOG_P'.
IF <fs_tr>-trstatus = 'R'.
IF <fs_tr>-btn_log_p IS INITIAL.
l_rc = lcl_assist=>tr_transport_log( i_trkorr = <fs_tr>-trkorr i_sys = 'P' )-retcode.
<fs_tr>-btn_log_p = SWITCH #(
l_rc WHEN '0000' THEN c_green
WHEN '0004' THEN c_yellow
WHEN '0008' THEN c_red
ELSE c_dummy ).
ENDIF.
ENDIF.
IF <fs_tr>-btn_log_p IS NOT INITIAL AND <fs_tr>-btn_log_p <> c_dummy.
CALL FUNCTION 'TMS_UI_SHOW_TRANSPORT_LOGS'
EXPORTING
iv_request = <fs_tr>-trkorr
iv_system = 'EP1'.
IF sy-subrc <> 0.
* Implement suitable error handling here
ENDIF.
ENDIF.
ENDCASE.
zcl_common=>alv_layout_refresh( grid_tr ).
" return the result and display in ALV( by refreshing the search results into ALV display)
grid_tr->refresh_table_display( ).
ENDIF.
ENDMETHOD.
METHOD handle_double_click.
READ TABLE gt_tr ASSIGNING FIELD-SYMBOL(<fs_tr>) INDEX e_row-index.
IF sy-subrc = 0.
CASE e_column-fieldname.
WHEN 'TRKORR'.
CALL FUNCTION 'TR_PRESENT_REQUEST'
EXPORTING
iv_trkorr = <fs_tr>-trkorr
* IV_HIGHLIGHT = 'X'
* IS_POPUP =
* IV_SHOWONLY = ' '
.
* WHEN .
ENDCASE.
ENDIF.
ENDMETHOD.
ENDCLASS.
CLASS lcl_search_evt IMPLEMENTATION.
METHOD user_command.
CASE e_ucomm.
WHEN 'REFRESH'.
ENDCASE.
ENDMETHOD.
METHOD toolbar .
DATA: ls_toolbar TYPE stb_button.
CLEAR ls_toolbar.
MOVE 'FILTER' TO ls_toolbar-function.
MOVE 'Filter' TO ls_toolbar-quickinfo.
MOVE icon_filter TO ls_toolbar-icon.
MOVE 'Filter' TO ls_toolbar-text.
MOVE '' TO ls_toolbar-disabled.
APPEND ls_toolbar TO e_object->mt_toolbar.
CLEAR ls_toolbar.
MOVE 'NOFILTER' TO ls_toolbar-function.
MOVE 'ResetFilter' TO ls_toolbar-quickinfo.
MOVE icon_filter_undo TO ls_toolbar-icon.
MOVE 'Reset' TO ls_toolbar-text.
MOVE '' TO ls_toolbar-disabled.
APPEND ls_toolbar TO e_object->mt_toolbar.
ENDMETHOD.
METHOD button_click . " ALV button column click handler
DATA:l_objcls TYPE seu_obj,
lt_findstr TYPE TABLE OF string,
lt_find_list TYPE TABLE OF rsfindlst,
ls_tadir TYPE tadir.
READ TABLE gt_search ASSIGNING FIELD-SYMBOL(<fs_search>) INDEX es_row_no-row_id.
IF sy-subrc = 0.
EXIT.
CASE abap_true.
WHEN gs_search_option-t100.
l_objcls = 'NN' . " message
WHEN gs_search_option-method.
l_objcls = 'OM' . " method
ENDCASE.
CALL METHOD cl_wb_object_type=>get_concatenated_key_from_id
EXPORTING
p_key_component1 = <fs_search>-obj_name
p_key_component2 = <fs_search>-sub_obj_name
p_external_id = CONV #( l_objcls )
RECEIVING
p_key = DATA(l_object_long_name).
* CALL METHOD cl_wb_infosystem=>create_where_used_list_request
APPEND l_object_long_name TO lt_findstr.
CALL FUNCTION 'RS_EU_CROSSREF'
EXPORTING
i_find_obj_cls = l_objcls
* I_SCOPE_OBJ_CLS = ' '
* REKURSIV = ' '
* I_ANSWER = ' '
* I_ACTUAL_INCLUDE = ' '
no_dialog = 'X'
* EXPAND_SOURCE_IN_BATCH_MODE = 'X'
* EXPAND_SOURCE_IN_ONLINE_MODE = ' '
* WITHOUT_TEXT = ' '
* WITH_GENERATED_OBJECTS = ' '
* I_FULL_NAME =
* I_SCOPE_OBJKEY =
* I_NO_FULLNAME_CONVERSION =
* IMPORTING
* O_SCOPE_OBJ_CLS =
* O_ANSWER =
* O_HITS =
TABLES
i_findstrings = lt_findstr
* O_REPOSITORY =
o_founds = lt_find_list
* O_FINDSTRINGS =
* I_SCOPE_OBJECTS =
* I_ACTUAL_SOURCE =
* I_SCOPE_OBJECT_CLS =
* I_SCOPE_DEVCLASS =
* I_EXCLUDE_SCOPE_OBJECT_CLS =
EXCEPTIONS
not_executed = 1
not_found = 2
illegal_object = 3
no_cross_for_this_object = 4
batch = 5
batchjob_error = 6
wrong_type = 7
object_not_exist = 8
OTHERS = 9.
IF sy-subrc <> 0.
* Implement suitable error handling here
ENDIF.
ENDIF.
ENDMETHOD.
METHOD menu_button.
CASE e_ucomm.
WHEN 'FILTER'.
ENDCASE.
ENDMETHOD.
ENDCLASS.
CLASS lcl_assist IMPLEMENTATION.
METHOD code_sync.
DATA:
lo_oo_include TYPE REF TO cl_oo_include_naming,
lt_source TYPE copc_t_remark_detail.
LOOP AT it_rows ASSIGNING FIELD-SYMBOL(<fs_row>) .
READ TABLE gt_current_obj ASSIGNING FIELD-SYMBOL(<fs_obj>) INDEX <fs_row>-row_id.
IF sy-subrc = 0.
e_objname = e_objname && <fs_obj>-progname && ','.
READ REPORT <fs_obj>-progname INTO lt_source.
IF <fs_obj>-progname CA '='. " it's a method
lo_oo_include ?= cl_oo_include_naming=>get_instance_by_include( <fs_obj>-progname ) .
DATA(l_method) = lo_oo_include->if_oo_class_incl_naming~get_mtdname_by_include( <fs_obj>-progname ).
CALL FUNCTION 'ZAB_SYNC_SOURCE_CODE'
DESTINATION i_rfc
EXPORTING
i_class = lo_oo_include->if_oo_clif_incl_naming~cifkey
i_method = l_method
* i_progname = <fs_obj>-progname
it_source = lt_source.
ELSE.
CALL FUNCTION 'ZAB_SYNC_SOURCE_CODE'
DESTINATION i_rfc
EXPORTING
i_progname = <fs_obj>-progname
it_source = lt_source.
ENDIF.
ENDIF.
ENDLOOP.
ENDMETHOD.
METHOD tr_transport_info.
DATA:
l_target_sys TYPE sy-sysid,
lt_comm_systems TYPE tmscsyslst_typ,
ls_setting TYPE ctslg_settings,
ls_cofile TYPE ctslg_cofile.
APPEND VALUE tmscsyslst( sysnam = sy-sysid ) TO lt_comm_systems.
l_target_sys = SWITCH #( i_sys WHEN 'Q' THEN 'EQ1'
WHEN 'T' THEN 'ET1'
WHEN 'P' THEN 'EP1' ).
APPEND VALUE trsysname( name = l_target_sys ) TO ls_setting-systems.
APPEND VALUE tmscsyslst( sysnam = l_target_sys ) TO lt_comm_systems.
ls_setting-detailed_depiction = 'X'.
* Get a minimum set of systems: one system per group
CALL FUNCTION 'TMS_CI_GET_SYSTEM_PER_GROUP'
CHANGING
it_syslist = lt_comm_systems
EXCEPTIONS
tms_not_configured = 1
list_incomplete = 2
OTHERS = 3.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE 'I' NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
CALL FUNCTION 'TR_READ_GLOBAL_INFO_OF_REQUEST'
EXPORTING
iv_trkorr = i_trkorr
is_settings = ls_setting
it_comm_systems = lt_comm_systems
IMPORTING
es_cofile = rs_cofile.
IF rs_cofile-imported = ''.
rs_cofile-rc = 999.
ENDIF.
ENDMETHOD.
METHOD tr_transport_log.
DATA :
lt_tr TYPE TABLE OF ctrs_requ,
l_tmssysnam TYPE tmssysnam,
l_exp TYPE flag,
lt_log TYPE tmstpalogs.
APPEND 'IEQ' && i_trkorr TO lt_tr.
l_tmssysnam = SWITCH #( i_sys WHEN 'Q' THEN 'EQ1'
WHEN 'T' THEN 'ET1'
WHEN 'P' THEN 'EP1' ).
IF l_tmssysnam = sy-sysid.
l_exp = abap_true.
ENDIF.
CALL FUNCTION 'TMS_TM_GET_TRLIST'
EXPORTING
iv_system = l_tmssysnam
iv_startdate = '20060101'
iv_starttime = '000000'
iv_enddate = '99991231'
iv_endtime = '240000'
iv_allcli = abap_true
iv_imports = abap_true
iv_exports = l_exp
iv_last_import = abap_true
IMPORTING
et_tmstpalog = lt_log
TABLES
irt_requests = lt_tr
EXCEPTIONS
alert = 1
OTHERS = 2.
IF sy-subrc = 0.
SORT lt_log BY trtime DESCENDING.
READ TABLE lt_log INTO rs_tmstpalog INDEX 1.
ENDIF.
ENDMETHOD.
METHOD tr_compress.
CALL FUNCTION 'TR_SORT_AND_COMPRESS_COMM'
EXPORTING
iv_trkorr = i_trkorr
* IV_DIALOG = ' '
* IMPORTING
* ES_REQUEST =
EXCEPTIONS
trkorr_not_found = 1
order_released = 2
error_while_modifying_obj_list = 3
tr_enqueue_failed = 4
no_authorization = 5
OTHERS = 6.
IF sy-subrc <> 0.
* Implement suitable error handling here
ENDIF.
ENDMETHOD.
METHOD tr_popup_filter.
DATA :
is_column TYPE stmsiqcol,
is_request TYPE stmsiqreq,
it_requests TYPE tmsiqreqs,
it_clients TYPE tmsiqclis,
it_projects TYPE tmsiqpros.
is_column-field = 'TRKORR'.
CALL FUNCTION 'TMS_UIQ_INT_POPUP_FILTER'
EXPORTING
is_column = is_column
is_request = is_request
it_requests = it_requests
it_clients = it_clients
it_projects = it_projects
CHANGING
ct_filter = ct_filter
EXCEPTIONS
cancelled_by_user = 1
OTHERS = 2.
IF sy-subrc <> 0.
* Implement suitable error handling here
ENDIF.
ENDMETHOD.
METHOD tr_release.
CALL FUNCTION 'TRINT_RELEASE_REQUEST'
EXPORTING
iv_trkorr = i_trkorr
iv_dialog = ''
* IV_AS_BACKGROUND_JOB = ' '
* IV_SUCCESS_MESSAGE = 'X'
* IV_WITHOUT_OBJECTS_CHECK = ' '
* IV_CALLED_BY_ADT = ' '
* IV_CALLED_BY_PERFORCE = ' '
* IV_WITHOUT_DOCU = ' '
iv_without_locking = 'X'
* IV_DISPLAY_EXPORT_LOG = 'X'
* IV_IGNORE_WARNINGS = ' '
* IV_SIMULATION = ' '
* IMPORTING
* ES_REQUEST =
* ET_DELETED_TASKS =
* ET_MESSAGES =
EXCEPTIONS
cts_initialization_failure = 1
enqueue_failed = 2
no_authorization = 3
invalid_request = 4
request_already_released = 5
repeat_too_early = 6
object_lock_error = 7
object_check_error = 8
docu_missing = 9
db_access_error = 10
action_aborted_by_user = 11
export_failed = 12
execute_objects_check = 13
release_in_bg_mode = 14
release_in_bg_mode_w_objchk = 15
error_in_export_methods = 16
object_lang_error = 17
OTHERS = 18.
IF sy-subrc <> 0.
" collect error message and then show in a popup dialog
* Implement suitable error handling here
ENDIF.
ENDMETHOD.
METHOD tr_excel_doi.
DATA:
lt_ranges TYPE soi_range_list,
lt_contents TYPE soi_generic_table,
lo_error TYPE REF TO i_oi_error.
g_prop_value_tr = 'ZAB_TR_LIST'.
g_application_name_tr = '传输请求列表'.
" download selected TR according the release TR list template
" Get Excel spreadsheet interface and display the excel in place in GUI.
go_sheet_tr = zcl_fi_utility=>get_spreadsheet_interface( " i_repid = sy-repid i_dynnr = '100'
EXPORTING i_object_key = 'ZAB0001'
i_repid = sy-repid
i_dynnr = sy-dynnr
i_prop_value = g_prop_value_tr
i_application_name = g_application_name_tr
IMPORTING eo_document = go_document_tr ).
go_sheet_tr->select_sheet( EXPORTING name = '1' IMPORTING error = lo_error ).
go_sheet_tr->insert_range_dim( EXPORTING name = 'INTERFACE' top = 999 left = 1 rows = 1 columns = 1 no_flush = 'X'
IMPORTING error = lo_error ) .
lt_ranges = VALUE soi_range_list( ( name = 'INTERFACE' rows = 1 columns = 1 code = 0 ) ).
APPEND INITIAL LINE TO lt_contents ASSIGNING FIELD-SYMBOL(<fs_content>).
<fs_content>-row = 1 .<fs_content>-column = '1' . <fs_content>-value = g_filename.
go_sheet_tr->set_ranges_data(
EXPORTING
ranges = lt_ranges
contents = lt_contents
no_flush = 'X'
IMPORTING error = lo_error
).
CALL METHOD go_document_tr->execute_macro
EXPORTING
macro_string = 'Module1.ExportTR'
no_flush = space
IMPORTING
error = lo_error.
CALL METHOD c_oi_errors=>raise_message
EXPORTING
type = 'E'.
ENDMETHOD.
ENDCLASS.
CLASS lcl_pai IMPLEMENTATION.
METHOD _on_okcode.
CASE i_saveok.
WHEN 'ENTER'.
press_enter( ).
WHEN 'SEARCH_OBJECTS'.
search_objects( ).
WHEN 'TR_DOWNLOAD'.
tr_download( ).
WHEN 'SWITCH_USR'.
tr_switch_usr( ).
ENDCASE.
ENDMETHOD.
METHOD press_enter.
CASE ts_dev-activetab.
WHEN 'TS_SEARCH'.
search_objects( ).
ENDCASE.
ENDMETHOD.
METHOD search_objects.
DATA: l_sstring TYPE text100.
IF g_search_string IS INITIAL.
RETURN.
ENDIF.
l_sstring = '%' && g_search_string && '%'.
CLEAR: gt_search[].
" search the input string pattern,
CASE abap_true.
WHEN gs_search_option-data_elem.
lcl_search=>search_data_elem( l_sstring ).
WHEN gs_search_option-method.
TRANSLATE l_sstring TO UPPER CASE .
lcl_search=>search_method( l_sstring ).
WHEN gs_search_option-t100.
lcl_search=>search_t100( l_sstring ).
ENDCASE.
DELETE gt_search WHERE spras <> sy-langu.
LOOP AT gt_search ASSIGNING FIELD-SYMBOL(<fs_search>).
<fs_search>-btn_use_list = icon_reference_list.
ENDLOOP.
zcl_common=>alv_layout_refresh( grid_search ).
" return the result and display in ALV( by refreshing the search results into ALV display)
grid_search->refresh_table_display( is_stable = CONV #( '#' ) ).
ENDMETHOD.
METHOD download_where_use.
* TYPES:
* BEGIN OF scope_object_cls ,
* type TYPE euobj-id,
* END OF scope_object_cls.
*
*
* DATA:
* lt_scope_key TYPE STAB_RANGE_OBJ,
* lt_scope_obj TYPE TABLE OF rsfind,
* lt_scope_object_cls TYPE TABLE OF scope_object_cls,
* lr_dev TYPE TABLE OF range_dev,
* l_objcls TYPE seu_obj,
* lt_findstr TYPE TABLE OF string,
* lt_find_list TYPE TABLE OF rsfindlst.
DATA: l_findstring TYPE rsfind,
l_scope_objects TYPE TABLE OF rsfind,
l_findstrings TYPE TABLE OF rsfind,
lt_founds TYPE STANDARD TABLE OF rsfindlst,
l_found TYPE rsfindlst,
l_position TYPE rsdepos,
l_full_name TYPE string.
DATA: l_find_obj_cls TYPE seu_obj,
l_scope_object_types TYPE rseutypes,
l_scope_obj_cls TYPE seu_obj.
DATA: xobjkey TYPE TABLE OF range_obj,
l_expand_source_objects TYPE abap_bool VALUE 'X'.
DATA:
p_environment_line TYPE if_ris_environment_types=>ty_s_senvi_tadir.
* REFRESH p_positions.
SELECT clsname, cmpname
INTO TABLE @DATA(lt_obj)
FROM seocompo
WHERE clsname LIKE 'ZCL_PO%'
AND cmptype = '1'.
* APPEND 'EEQ$TMP' TO lr_dev.
* APPEND 'ICPZ++01' TO lr_dev.
LOOP AT lt_obj ASSIGNING FIELD-SYMBOL(<fs_obj>).
CLEAR:
p_environment_line.
p_environment_line-obj_type = 'CLAS'.
p_environment_line-obj_name = <fs_obj>-clsname.
p_environment_line-sub_type = 'METH'.
p_environment_line-sub_name = <fs_obj>-cmpname.
CALL METHOD cl_wb_ris_environment=>get_where_used_list_parameters
EXPORTING
senvi_tadir = p_environment_line
IMPORTING
find_obj_cls = l_find_obj_cls
findstring = l_findstring
scope_obj_cls = l_scope_obj_cls
scope_objects = l_scope_objects
full_name = l_full_name.
APPEND l_scope_obj_cls TO l_scope_object_types.
APPEND l_findstring TO l_findstrings.
* PERFORM fill_obj_key TABLES xobjkey l_scope_objects
* USING l_find_obj_cls
* p_environment_line-include_name
* l_expand_source_objects.
REFRESH lt_founds.
CALL FUNCTION 'RS_EU_CROSSREF'
EXPORTING
i_find_obj_cls = l_find_obj_cls
i_full_name = l_full_name
no_dialog = 'X'
without_text = 'X'
expand_source_in_online_mode = l_expand_source_objects
i_scope_objkey = xobjkey
TABLES
i_findstrings = l_findstrings
i_scope_objects = l_scope_objects
i_scope_object_cls = l_scope_object_types
o_founds = lt_founds
EXCEPTIONS
OTHERS = 0.
APPEND LINES OF lt_founds TO gt_find_list.
ENDLOOP.
zcl_base_utility=>download_file( CHANGING it_data = gt_find_list ).
ENDMETHOD.
METHOD tr_download.
DATA:
l_index TYPE i,
lt_output_meta TYPE TABLE OF zsab0021,
ls_output_meta TYPE zsab0021. " 输出到EXCEL的原始数据 ,格式: sheetname / row no/ col no / cell content
" get selected TR
CALL METHOD grid_tr->get_selected_rows
IMPORTING
et_row_no = DATA(lt_rows).
" generate metadata file
ls_output_meta-sheet_name = '1'. CONDENSE ls_output_meta-sheet_name.
LOOP AT lt_rows ASSIGNING FIELD-SYMBOL(<fs_row>).
l_index = sy-tabix + 9.
READ TABLE gt_tr ASSIGNING FIELD-SYMBOL(<fs_tr>) INDEX <fs_row>-row_id.
IF sy-subrc = 0.
ls_output_meta-row = l_index. "抬头信息在第一行输出
ls_output_meta-column = 1. " ID no.
ls_output_meta-value = l_index . CONDENSE ls_output_meta-value .
APPEND ls_output_meta TO lt_output_meta.
ls_output_meta-column = 2. " TR number
ls_output_meta-value = <fs_tr>-trkorr .
APPEND ls_output_meta TO lt_output_meta.
ls_output_meta-column = 4. " TR desc
ls_output_meta-value = <fs_tr>-as4text.
APPEND ls_output_meta TO lt_output_meta.
ls_output_meta-column = 10. " TR owner
ls_output_meta-value = <fs_tr>-as4user.
APPEND ls_output_meta TO lt_output_meta.
ENDIF.
ENDLOOP.
" save to local
g_filename = zcl_base_utility=>download_file( CHANGING it_data = lt_output_meta ).
" start Excel download
CALL SCREEN 9001.
" delete the temp file
zcl_base_utility=>delete_file( g_filename ).
ENDMETHOD.
METHOD tr_switch_usr.
CALL SCREEN 8301 STARTING AT 5 5 ENDING AT 50 12 .
ENDMETHOD.
method tr_check_version.
DATA:
lt_tr_sel TYPE tmsiqfils.
" 弹出TR选择对话框
LCL_ASSIST=>tr_popup_filter( CHANGING ct_filter = lt_tr_sel ).
IF lt_tr_sel[] IS INITIAL.
MESSAGE s733(wu) DISPLAY LIKE 'E'.
RETURN.
ENDIF.
" 取当前传输请求号中的对象及版本
SELECT OBJTYPE, OBJNAME, VERSNO, KORRNUM, LOEKZ
FROM vrsd
INTO TABLE @DATA(lt_vrsd_current)
FOR ALL ENTRIES IN @lt_tr_sel
WHERE KORRNUM = @lt_tr_sel-value+0(20).
SORT lt_vrsd_current by OBJTYPE OBJNAME VERSNO .
" 从VRSD表中取TR中的对象的历史版本
SELECT OBJTYPE, OBJNAME, VERSNO, KORRNUM
FROM vrsd
INTO TABLE @DATA(lt_vrsd_history)
FOR ALL ENTRIES IN @lt_vrsd_current
WHERE OBJTYPE = @lt_vrsd_current-OBJTYPE
AND OBJNAME = @lt_vrsd_current-OBJNAME
.
SORT lt_vrsd_history by OBJTYPE OBJNAME VERSNO .
" 对当前批次的请求号,逐个校验是否有更新版本的请求号,且该请求号,未包含在此次的批量传输清单中。
" 获取最大版本号
LOOP AT lt_vrsd_current ASSIGNING FIELD-SYMBOL(<fs_current>).
READ TABLE lt_vrsd_current ASSIGNING FIELD-SYMBOL(<fs_current_highest>)
with key OBJTYPE = <fs_current>-OBJTYPE OBJNAME = <fs_current>-OBJNAME BINARY SEARCH.
IF sy-subrc = 0.
READ TABLE lt_vrsd_history ASSIGNING FIELD-SYMBOL(<fs_history_highest>)
with key OBJTYPE = <fs_current>-OBJTYPE OBJNAME = <fs_current>-OBJNAME BINARY SEARCH.
IF sy-subrc = 0.
IF <fs_current_highest>-VERSNO <> <fs_history_highest>-VERSNO.
<fs_current>-LOEKZ = 'F'. " 借用LOEKZ字段,用于保存检查结果不一致的数据
ENDIF.
ENDIF.
ENDIF.
ENDLOOP.
delete lt_vrsd_current WHERE LOEKZ <> 'F'.
" 如有差异,弹出对话框显示检查结果;
IF lt_vrsd_current[] IS INITIAL.
MESSAGE 'Success' TYPE 'S'.
else.
MESSAGE 'Fail' TYPE 'S'.
ENDIF.
" 如无差异,检查正常,则显示成功消息
endmethod.
METHOD leave.
notification( 'LEAVE' ).
ENDMETHOD.
METHOD notification.
DATA:
" mail related
l_to TYPE string,
l_cc TYPE string,
l_subject TYPE string,
l_content TYPE string.
SELECT * INTO TABLE @DATA(lt_ab33) FROM ztab0033 WHERE bname = @sy-uname .
IF sy-subrc <> 0.
MESSAGE 'Please maintain ztab0033.' TYPE 'S' DISPLAY LIKE 'W'.
RETURN.
ENDIF.
SELECT * INTO TABLE @DATA(lt_ab34) FROM ztab0034 FOR ALL ENTRIES IN @lt_ab33
WHERE mail_group = @lt_ab33-mail_group.
IF sy-subrc <> 0.
MESSAGE 'Please maintain ztab0034.' TYPE 'S' DISPLAY LIKE 'W'.
RETURN.
ENDIF.
LOOP AT lt_ab33 ASSIGNING FIELD-SYMBOL(<fs_33>).
LOOP AT lt_ab34 ASSIGNING FIELD-SYMBOL(<fs_34>) WHERE mail_group = <fs_33>-mail_group.
IF <fs_33>-zcc IS INITIAL.
l_to = l_to && <fs_34>-mail_address.
ELSE.
l_cc = l_cc && <fs_34>-mail_address.
ENDIF.
ENDLOOP.
ENDLOOP.
CASE i_type.
WHEN 'LEAVE'.
l_subject = '请假知会'.
l_content = '本人请假 天,时间:' && sy-datum && '请知悉'.
WHEN 'FLYBACK'.
l_subject = 'FLYBACK知会'.
l_content = '本周Flyback,时间:' && sy-datum && '请知悉'.
ENDCASE.
CALL METHOD zcl_transports_utilities=>generate_outlook_mail
EXPORTING
i_to_address = l_to
i_cc_address = l_cc
i_mail_subject = l_subject
i_mail_content = l_content.
ENDMETHOD.
METHOD flyback.
notification( 'FLYBACK' ).
ENDMETHOD.
ENDCLASS.
CLASS lcl_search IMPLEMENTATION.
METHOD search_t100.
SELECT *
INTO TABLE @DATA(lt_t100)
FROM t100
WHERE text LIKE @i_sstring
AND arbgb IN ( SELECT obj_name FROM tadir WHERE pgmid = 'R3TR' AND object = 'MSAG' AND devclass LIKE 'Z%' ).
IF sy-subrc = 0.
LOOP AT lt_t100 ASSIGNING FIELD-SYMBOL(<fs_t100>).
APPEND INITIAL LINE TO gt_search ASSIGNING FIELD-SYMBOL(<fs_s>).
<fs_s>-obj_name = <fs_t100>-arbgb.
<fs_s>-sub_obj_name = <fs_t100>-msgnr.
<fs_s>-text = <fs_t100>-text.
<fs_s>-spras = <fs_t100>-sprsl.
ENDLOOP.
ENDIF.
ENDMETHOD.
METHOD search_data_elem.
IF gs_search_option-only_z IS NOT INITIAL.
s_dyn_cond = `t~rollname IN ( SELECT obj_name FROM tadir WHERE pgmid = 'R3TR' AND object = 'DTEL' AND devclass LIKE 'Z%' )`.
ELSE.
CLEAR: s_dyn_cond.
ENDIF.
SELECT t~rollname, t~ddlanguage, t~ddtext, t~reptext, t~scrtext_s, t~scrtext_m, t~scrtext_l,
l~domname, l~datatype, l~leng, l~decimals
INTO TABLE @DATA(lt_dd04t)
FROM dd04t AS t
INNER JOIN dd04l AS l ON l~rollname = t~rollname AND l~as4local = t~as4local AND l~as4vers = t~as4vers
WHERE ddlanguage = @sy-langu
AND t~as4local = 'A'
AND reptext LIKE @i_sstring
AND (s_dyn_cond).
IF sy-subrc = 0.
LOOP AT lt_dd04t ASSIGNING FIELD-SYMBOL(<fs_dd04t>).
APPEND INITIAL LINE TO gt_search ASSIGNING FIELD-SYMBOL(<fs_s>).
MOVE-CORRESPONDING <fs_dd04t> TO <fs_s>.
<fs_s>-obj_name = <fs_dd04t>-rollname.
<fs_s>-text = <fs_dd04t>-ddtext.
<fs_s>-spras = <fs_dd04t>-ddlanguage.
ENDLOOP.
ENDIF.
ENDMETHOD.
METHOD search_method.
IF gs_search_option-only_z IS NOT INITIAL.
s_dyn_cond = ` CLSNAME LIKE 'Z%' `.
ELSE.
CLEAR: s_dyn_cond.
ENDIF.
SELECT *
INTO TABLE @DATA(lt_method)
FROM seocompotx
WHERE ( cmpname LIKE @i_sstring
OR descript LIKE @i_sstring )
AND (s_dyn_cond) .
IF sy-subrc = 0.
LOOP AT lt_method ASSIGNING FIELD-SYMBOL(<fs_method>).
APPEND INITIAL LINE TO gt_search ASSIGNING FIELD-SYMBOL(<fs_s>).
<fs_s>-obj_name = <fs_method>-clsname.
<fs_s>-sub_obj_name = <fs_method>-cmpname.
<fs_s>-text = <fs_method>-descript.
<fs_s>-spras = <fs_method>-langu.
ENDLOOP.
ENDIF.
ENDMETHOD.
ENDCLASS.