How to implement:
- Create a executable report in your SAP development system with name ZNM_OBJS_DEP_TRANS and description Object Dependencies and Transport using transaction SE38;
- Copy past code bellow and activate the program;
- Create/Fill corresponding Text Symbols and Selection Texts. Please check the meaning at top comments of the program;
- Create GUI Status with name STATUS and add standard functions &ALL, &SAL, &OUP, &ODN, &ILT, %PC, &OL0, &OAD and &AVE.
Create customer function code TR :
If you are not able to activate the program because of nonexistent standard objects please downgrade for earlier SAP versions. If you need help on it, please kept me informed.
Copy past the code bellow or download the attached file:
REPORT znm_objs_dep_trans MESSAGE-ID 00.
*----------------------------------------------------------------------*
* Report ZZS_OBJ_DEP_TRANS - Object Dependencies and Transport by Nuno Morais
*----------------------------------------------------------------------*
* Text Symbols
* B01 Object selection
* B02 Aditional options
* C01 Remote
* C02 Obj. Desc.
* CM1 Cross-system objects version check
* M01 Object not found
* M02 Please fill all required fields
* M03 Critical error
* M04 No objects selected
* M05 Transport not allowed for multiple targets
* M06 Error creating transport request
* M07 Objects added to request (
* M08 Please select a remote system
* M09 RFCs destinations missing
* M10 Request canceled, at least one object $TEMP detected
* M11 Navigation not possible
* M12 Transport canceled
* M13 Object dependencies check not support
* M14 No dependecies found
* O01 Equal
* O02 Different
* O03 New
* O04 No version
* P01 Adding object
* P02 Checking Dependecies
* P03 Checking Remote
* P04 Display objects
* P05 Processing options
* PB1 % Complete
*
* Selection Texts
* P_ERFC Exclude RFCs if exist
* P_ICD Include Tables CDs
* P_ILO Include Tables Locks
* P_ITM Include Tables Maintenances
* P_OBJECT Object Type
* P_OBJ_N Object Name
* P_PGMID Program ID
* P_RFC Remote versions checks
* P_RFC_D System Name
*
* Standard Status GUI function codes: &ALL, &SAL, &OUP, &ODN, &ILT, %PC, &OL0, &OAD and &AVE
* Status GUI function code: TR Create transport
*
*----------------------------------------------------------------------*
* GLOBAL DATA
*----------------------------------------------------------------------*
TYPE-POOLS: abap, icon. "Only for old versions
*----------------------------------------------------------- Constants *
CONSTANTS:
gc_r3tr TYPE pgmid VALUE 'R3TR', "Main object
gc_tobj TYPE trobjtype VALUE 'TOBJ', "Table content in transport
gc_chdo TYPE trobjtype VALUE 'CHDO', "Change documents
gc_fugr TYPE trobjtype VALUE 'FUGR', "Function group
gc_tabl TYPE trobjtype VALUE 'TABL', "Table
gc_temp TYPE developclass VALUE '$TMP'. "Local development class
*---------------------------------------------------------- Structures *
TYPES:
BEGIN OF gty_objects,
status TYPE icon_d, "Check status
pgmid TYPE pgmid, "Program ID in Requests and Tasks
object TYPE trobjtype, "Object Type
obj_name TYPE sobj_name, "Object Name in Object Directory
obj_desc TYPE ddtext, "Object Explanatory short text
devclass TYPE developclass, "Development Package
target TYPE tr_target, "Transport Target of Request
remote TYPE char10, "Remote check status
END OF gty_objects.
SET EXTENDED CHECK OFF.
DATA:
gt_objects TYPE TABLE OF gty_objects, "Objects to transport
gt_objs_desc TYPE TABLE OF ko100, "Objects prograns IDs
gt_e071 TYPE TABLE OF e071,
gt_e071k TYPE TABLE OF e071k. "Change & Transport System: Object Entries of Requests/Tasks
*----------------------------------------------------------- Variables *
DATA gv_percent TYPE i. "Progress bar percentage
*------------------------------------------------------ Class Handler *
DATA go_objects TYPE REF TO cl_salv_table. "Objects ALV
SET EXTENDED CHECK ON.
*----------------------------------------------------------------------*
* CLASS gcl_handle_events DEFINITION
*----------------------------------------------------------------------*
CLASS lcl_handle_events DEFINITION FINAL.
PUBLIC SECTION.
METHODS:
on_user_command FOR EVENT added_function OF cl_salv_events
IMPORTING e_salv_function,
on_double_click FOR EVENT double_click OF cl_salv_events_table
IMPORTING row column. "#EC NEEDED
ENDCLASS. "lcl_handle_events DEFINITION
*----------------------------------------------------------------------*
* SELECTION SCREEN
*----------------------------------------------------------------------*
*---------------------------------------------------- Object selection *
SELECTION-SCREEN BEGIN OF BLOCK b01 WITH FRAME TITLE text-b01.
SELECTION-SCREEN SKIP 1.
SELECTION-SCREEN BEGIN OF LINE.
PARAMETERS:
p_pgmid TYPE pgmid DEFAULT gc_r3tr, "Program ID in Requests and Tasks
p_object TYPE trobjtype, "Object Type
p_obj_n TYPE sobj_name. "Object Name in Object Directory
SELECTION-SCREEN END OF LINE.
SELECTION-SCREEN SKIP 1.
SELECTION-SCREEN BEGIN OF LINE. "Remote versions checks
PARAMETERS: p_rfc AS CHECKBOX.
SELECTION-SCREEN COMMENT (37) com_rfc.
PARAMETERS: p_rfc_d TYPE tmssysnam.
SELECTION-SCREEN END OF LINE.
SELECTION-SCREEN END OF BLOCK b01.
*-------------------------------------------------- Aditional options *
SELECTION-SCREEN BEGIN OF BLOCK b02 WITH FRAME TITLE text-b02.
SELECTION-SCREEN SKIP 1.
PARAMETERS:
p_itm AS CHECKBOX, "Include Tables Maintenance
p_ilo AS CHECKBOX, "Include Lock objects
p_icd AS CHECKBOX, "Include Change documents
p_erfc AS CHECKBOX. "Exclude RFCs if exist
SELECTION-SCREEN END OF BLOCK b02.
*--------------------------------------*
* Selection Screen PAI Helps
*--------------------------------------*
*------------------------------------------------------- Program ID F4 *
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_pgmid.
PERFORM pgmid_f4.
*------------------------------------------------------ Object Type F4 *
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_object.
PERFORM object_f4.
*------------------------------------------------------ Object Name F4 *
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_obj_n.
PERFORM object_name_f4.
*-------------------------------------------------- Systems and RFC F4 *
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_rfc_d.
PERFORM rfc_f4.
*--------------------------------*
* Selection Screen PAI
*--------------------------------*
AT SELECTION-SCREEN.
PERFORM screen_pai.
*----------------------------------------------------------------------*
* REPORT EVENTS
*----------------------------------------------------------------------*
*---------------------------------*
* Initialization events
*---------------------------------*
INITIALIZATION.
PERFORM load_of_program.
*---------------------------------*
* Executing events
*---------------------------------*
START-OF-SELECTION.
PERFORM run_checks.
END-OF-SELECTION.
PERFORM display_objects.
*----------------------------------------------------------------------*
* CLASS lcl_handle_events IMPLEMENTATION *
*----------------------------------------------------------------------*
CLASS lcl_handle_events IMPLEMENTATION.
*-------------------------------------------------------- User command *
METHOD on_user_command.
CHECK e_salv_function = 'TR'. "Create transport request
DATA lr_selections TYPE REF TO cl_salv_selections. "ALV Selections
DATA:
lt_rows TYPE salv_t_row, "ALV Rows
ls_row TYPE i,
lt_e071_temp TYPE TABLE OF e071, "Change & Transport System: Object Entries of Requests/Tasks
ls_e071 LIKE LINE OF gt_e071,
lt_e071k_temp TYPE TABLE OF e071k,
lt_objects TYPE TABLE OF gty_objects, "Objects to transport
ls_object LIKE LINE OF gt_objects,
lt_targets TYPE TABLE OF tr_target, "Transport Target of Request
ls_target LIKE LINE OF lt_targets.
DATA:
lv_order TYPE trkorr, "Request/Task
lv_task TYPE trkorr.
*---------- Get selected lines ----------*
lr_selections = go_objects->get_selections( ).
lt_rows = lr_selections->get_selected_rows( ).
*---------- Get selected objects to transport ----------*
LOOP AT lt_rows INTO ls_row.
READ TABLE gt_objects INTO ls_object INDEX ls_row.
IF sy-subrc IS INITIAL AND ls_object-status = icon_led_green.
IF ls_object-devclass = gc_temp. "Request canceled, at least one object $TEMP detected
MESSAGE i001 WITH text-m10 space space space DISPLAY LIKE 'E'.
RETURN.
ENDIF.
APPEND ls_object TO lt_objects.
MOVE-CORRESPONDING ls_object TO ls_e071.
APPEND ls_e071 TO gt_e071.
IF ls_object-object = gc_tobj. "Add TABU object directly to the transport
PERFORM add_tobj_content USING ls_object-obj_name.
ENDIF.
ENDIF.
ENDLOOP.
*---------- Get possible target ----------*
LOOP AT lt_objects INTO ls_object.
ls_target = ls_object-target.
APPEND ls_target TO lt_targets.
ENDLOOP.
SORT lt_targets.
DELETE ADJACENT DUPLICATES FROM lt_targets.
*---------- Create transport request and task ----------*
IF lt_objects IS NOT INITIAL. "Objects selected to transport
IF lines( lt_targets ) = 1. "Only one valid target
CALL FUNCTION 'TRINT_ORDER_CHOICE' "Create transport request
EXPORTING
iv_tarsystem = ls_target
IMPORTING
we_order = lv_order
we_task = lv_task
TABLES
wt_e071 = lt_e071_temp
wt_e071k = lt_e071k_temp
EXCEPTIONS
no_correction_selected = 1
display_mode = 2
object_append_error = 3
recursive_call = 4
wrong_order_type = 5
OTHERS = 6.
IF sy-subrc IS INITIAL AND lv_task IS NOT INITIAL.
ls_e071-pgmid = gc_r3tr. "Add objects development class to transport
ls_e071-object = 'DEVC'.
ls_e071-obj_name = ls_object-devclass.
APPEND ls_e071 TO gt_e071.
CALL FUNCTION 'TRINT_APPEND_COMM' "Add object to transport request
EXPORTING
wi_exclusive = abap_false
wi_sel_e071 = abap_true
wi_sel_e071k = abap_true
wi_trkorr = lv_task
TABLES
wt_e071 = gt_e071
wt_e071k = gt_e071k
EXCEPTIONS
e071k_append_error = 1
e071_append_error = 2
trkorr_empty = 3
OTHERS = 4.
IF sy-subrc IS INITIAL. "Added with sucess
*---------- Sort and compress request --------*
CALL FUNCTION 'TR_SORT_AND_COMPRESS_COMM' "#EC FB_RC "#EC CI_SUBRC
EXPORTING
iv_trkorr = lv_task
EXCEPTIONS
trkorr_not_found = 1
order_released = 2
error_while_modifying_obj_list = 3
tr_enqueue_failed = 4
no_authorization = 5
OTHERS = 6.
MESSAGE i001 WITH text-m07 lv_order ')' space. "Objects added to request
ELSE. "Error creating transport request
MESSAGE s001 WITH text-m06 space space space DISPLAY LIKE 'E'.
ENDIF.
ELSE. "Transport canceled
MESSAGE s001 WITH text-m12 space space space DISPLAY LIKE 'W'.
ENDIF.
ELSE. "Transport not allowed for multiple targets
MESSAGE i001 WITH text-m05 space space space.
ENDIF.
ELSE. "No objects selected
MESSAGE i001 WITH text-m04 space space space.
ENDIF.
ENDMETHOD. "on_user_command
*-------------------------------------------------------- Line dbclick *
METHOD on_double_click.
DATA ls_object LIKE LINE OF gt_objects. "Objects to transport
READ TABLE gt_objects INTO ls_object INDEX row.
IF sy-subrc IS INITIAL.
*---------- Display objects ----------*
CASE ls_object-object.
WHEN gc_tobj. "Display Tables Maintenance
SET PARAMETER ID 'DVI' FIELD ls_object-obj_name.
CALL TRANSACTION 'SE54'. "#EC CI_CALLTA
WHEN gc_chdo. "Display change documents
CALL TRANSACTION 'SCDO'. "#EC CI_CALLTA
WHEN OTHERS. "Display all
CALL FUNCTION 'RS_TOOL_ACCESS'
EXPORTING
operation = 'SHOW'
object_name = ls_object-obj_name
object_type = ls_object-object
EXCEPTIONS
not_executed = 1
invalid_object_type = 2
OTHERS = 3.
IF sy-subrc IS NOT INITIAL. "Navigation not possible
MESSAGE s001 WITH text-m11 space space space DISPLAY LIKE 'W'.
ENDIF.
ENDCASE.
ENDIF.
ENDMETHOD. "on_double_click
ENDCLASS. "lcl_handle_events IMPLEMENTATION
*----------------------------------------------------------------------*
* FORMS
*----------------------------------------------------------------------*
*&---------------------------------------------------------------------*
*& Form LOAD_OF_PROGRAM
*&---------------------------------------------------------------------*
FORM load_of_program .
com_rfc = text-cm1. "Cross-system objects versions check
CALL FUNCTION 'TR_OBJECT_TABLE' "Fill Program IDs
TABLES
wt_object_text = gt_objs_desc.
ENDFORM. " LOAD_OF_PROGRAM
*----------------------------------------------------------------------*
* Form PGMID_F4 - Program ID F4
*----------------------------------------------------------------------*
FORM pgmid_f4 .
DATA lt_pgmids TYPE TABLE OF ko101. "Program IDs with Description
*---------- Read PGMID ----------*
CALL FUNCTION 'TR_PGMID_TABLE'
TABLES
wt_pgmid_text = lt_pgmids.
*---------- Set PGMID F4 ----------*
CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST' "#EC FB_RC
EXPORTING
retfield = 'PGMID'
dynpprog = sy-cprog
value_org = 'S'
dynpnr = '1000'
dynprofield = 'TRE071X-PGMID'
TABLES
value_tab = lt_pgmids
EXCEPTIONS
parameter_error = 1
no_values_found = 2
OTHERS = 3.
ENDFORM. " PGMID_F4
*----------------------------------------------------------------------*
* Form OBJECT_F4 - Object Type F4
*----------------------------------------------------------------------*
FORM object_f4.
DATA:
lt_shlp TYPE shlp_descr, "Description of Search Help
lt_return_values TYPE TABLE OF ddshretval, "Interface Structure Search Help
ls_return_values LIKE LINE OF lt_return_values,
lv_rc TYPE sysubrc. "Return Value of ABAP Statements
FIELD-SYMBOLS <interface> TYPE ddshiface. "Interface description of a F4 help method
*---------- Get search help ----------*
CALL FUNCTION 'F4IF_GET_SHLP_DESCR'
EXPORTING
shlpname = 'SCTSOBJECT'
IMPORTING
shlp = lt_shlp.
*---------- Fill search help ----------*
LOOP AT lt_shlp-interface ASSIGNING <interface>.
IF <interface>-shlpfield = 'OBJECT'.
<interface>-valfield = abap_true.
<interface>-value = p_object.
ENDIF.
IF <interface>-shlpfield = 'PGMID'.
<interface>-valfield = abap_true.
<interface>-value = p_pgmid.
ENDIF.
ENDLOOP.
*---------- Call search help ----------*
CALL FUNCTION 'F4IF_START_VALUE_REQUEST'
EXPORTING
shlp = lt_shlp
IMPORTING
rc = lv_rc
TABLES
return_values = lt_return_values.
*---------- Set search help return ----------*
IF lv_rc IS INITIAL.
READ TABLE lt_return_values INTO ls_return_values WITH KEY fieldname = 'OBJECT'.
IF sy-subrc IS INITIAL.
p_object = ls_return_values-fieldval.
ENDIF.
READ TABLE lt_return_values INTO ls_return_values WITH KEY fieldname = 'PGMID'.
IF sy-subrc IS INITIAL.
p_pgmid = ls_return_values-fieldval.
ENDIF.
ENDIF.
ENDFORM. " OBJECT_F4
*----------------------------------------------------------------------*
* Form OBJECT_NAME_F4 - Object Name F4
*----------------------------------------------------------------------*
FORM object_name_f4.
DATA lv_object_type TYPE seu_obj. "Object type
*---------- Get objects repository information ----------*
lv_object_type = p_object.
CALL FUNCTION 'REPOSITORY_INFO_SYSTEM_F4' "#EC FB_RC
EXPORTING
object_type = lv_object_type
object_name = p_obj_n
IMPORTING
object_name_selected = p_obj_n
EXCEPTIONS
cancel = 1
wrong_type = 2
OTHERS = 3.
ENDFORM. " OBJECT_NAME_F4
*&---------------------------------------------------------------------*
*& Form RFC_F4
*&---------------------------------------------------------------------*
FORM rfc_f4 .
CALL FUNCTION 'TMS_UI_F4_SYSTEMS'
CHANGING
cv_system = p_rfc_d.
ENDFORM. " RFC_F4
*&---------------------------------------------------------------------*
*& Form SCREEN_PAI
*&---------------------------------------------------------------------*
FORM screen_pai .
DATA ls_env_dummy TYPE senvi.
IF sy-ucomm = 'ONLI'.
*---------- Check required data ----------*
IF p_pgmid IS INITIAL OR p_object IS INITIAL OR p_obj_n IS INITIAL OR
( p_rfc IS NOT INITIAL AND p_rfc_d IS INITIAL ).
MESSAGE e001 WITH text-m02 space space space DISPLAY LIKE 'W'. "Please fill all required fields
ENDIF.
IF p_rfc IS NOT INITIAL AND p_rfc_d = sy-sysid.
MESSAGE e001 WITH text-m08 space space space DISPLAY LIKE 'W'. "Please select a remote system
ENDIF.
*---------- Add first object ----------*
PERFORM progress_bar USING text-p01 '10'. "Adding object
PERFORM check_add_object USING p_pgmid p_object p_obj_n ls_env_dummy.
IF gt_objects IS INITIAL.
MESSAGE e001 WITH text-m01 space space space DISPLAY LIKE 'W'. "Object not found
ENDIF.
ENDIF.
ENDFORM. " SCREEN_PAI
*----------------------------------------------------------------------*
* Form PROGRESS_BAR
*----------------------------------------------------------------------*
FORM progress_bar USING i_value TYPE itex132
i_tabix TYPE i.
DATA:
lv_text(40),
lv_percentage TYPE p,
lv_percent_char(3).
lv_percentage = ( i_tabix / 100 ) * 100.
lv_percent_char = lv_percentage.
SHIFT lv_percent_char LEFT DELETING LEADING ' '.
CONCATENATE i_value '...' INTO i_value.
CONCATENATE i_value lv_percent_char text-pb1 INTO lv_text SEPARATED BY space.
IF lv_percentage GT gv_percent OR i_tabix = 1.
CALL FUNCTION 'SAPGUI_PROGRESS_INDICATOR'
EXPORTING
percentage = lv_percentage
text = lv_text.
gv_percent = lv_percentage.
ENDIF.
ENDFORM. " PROGRESS_BAR
*&---------------------------------------------------------------------*
*& Form RUN_CHECKS
*&---------------------------------------------------------------------*
FORM run_checks .
IF gt_objects IS NOT INITIAL.
*---------- Dependecies check ----------*
PERFORM progress_bar USING text-p02 '20'. "Checking Dependecies
PERFORM objects_dependencies_check.
PERFORM progress_bar USING text-p05 '50'. "Processing options
*---------- Include Tables Maintenance ----------*
IF p_itm IS NOT INITIAL.
PERFORM include_maintenances.
PERFORM objects_dependencies_check.
ENDIF.
*---------- Include Lock objects ----------*
IF p_ilo IS NOT INITIAL. PERFORM include_locks. ENDIF.
*---------- Include Change documents ----------*
IF p_icd IS NOT INITIAL. PERFORM include_cds. ENDIF.
*---------- Remote check ----------*
IF p_rfc IS NOT INITIAL.
PERFORM progress_bar USING text-p03 '80'. "Checking Remote
PERFORM remote_objects_check.
ENDIF.
ENDIF.
ENDFORM. " RUN_CHECKS
*----------------------------------------------------------------------*
* Form DISPLAY_OBJECTS
*----------------------------------------------------------------------*
FORM display_objects.
DATA:
lr_events TYPE REF TO cl_salv_events_table, "ALV Events
lr_display TYPE REF TO cl_salv_display_settings, "ALV Output Appearance
lr_columns TYPE REF TO cl_salv_columns_table, "ALV Columns
lr_column TYPE REF TO cl_salv_column_table,
lr_selections TYPE REF TO cl_salv_selections, "ALV Selections
lr_layout TYPE REF TO cl_salv_layout, "ALV Layout
lo_event_handler TYPE REF TO lcl_handle_events. "ALV Events Handler
DATA:
lt_column_ref TYPE salv_t_column_ref, "Columns of ALV List
ls_column_ref TYPE salv_s_column_ref,
ls_key TYPE salv_s_layout_key.
DATA:
lv_title TYPE lvc_title, "ALV title
lv_lines TYPE i, "Number of objects
lv_lines_c TYPE string.
IF gt_objects IS NOT INITIAL.
PERFORM progress_bar USING text-p04 '90'. "Display objects
IF go_objects IS NOT BOUND. "Create ALV
TRY.
IF lines( gt_objects ) = 1. "No dependecies found
MESSAGE s001 WITH text-m14 space space space DISPLAY LIKE 'W'.
ELSE.
SORT gt_objects BY pgmid object obj_name.
ENDIF.
*---------- Create ALV ----------*
cl_salv_table=>factory( IMPORTING r_salv_table = go_objects
CHANGING t_table = gt_objects ).
*---------- Set ALV Functions ----------*
go_objects->set_screen_status(
pfstatus = 'STATUS'
report = sy-cprog
set_functions = go_objects->c_functions_all ).
*---------- Set Layout ----------*
lr_layout = go_objects->get_layout( ).
ls_key-report = sy-repid.
lr_layout->set_key( ls_key ).
lr_layout->set_save_restriction( ).
*---------- Set ALV selections ----------*
lr_selections = go_objects->get_selections( ).
lr_selections->set_selection_mode( if_salv_c_selection_mode=>row_column ).
*---------- Set ALV Display and Title ----------*
lr_display = go_objects->get_display_settings( ).
lr_display->set_striped_pattern( if_salv_c_bool_sap=>true ).
lv_lines = lines( gt_objects ).
lv_lines_c = lv_lines.
CONDENSE lv_lines_c NO-GAPS.
CONCATENATE '(' lv_lines_c ')' INTO lv_lines_c.
CONCATENATE sy-title lv_lines_c INTO lv_title SEPARATED BY space.
lr_display->set_list_header( lv_title ).
*---------- Set ALV Columns ----------*
lr_columns = go_objects->get_columns( ).
lr_columns->set_key_fixation( ).
lr_columns->set_optimize( ).
lt_column_ref = lr_columns->get( ).
LOOP AT lt_column_ref INTO ls_column_ref. "Default format for all columns
lr_column ?= lr_columns->get_column( ls_column_ref-columnname ).
lr_column->set_f4( if_salv_c_bool_sap=>false ).
lr_column->set_alignment( if_salv_c_alignment=>centered ).
IF ls_column_ref-columnname = 'STATUS' OR
ls_column_ref-columnname = 'PGMID' OR
ls_column_ref-columnname = 'OBJECT' OR
ls_column_ref-columnname = 'OBJ_NAME'.
lr_column->set_key( if_salv_c_bool_sap=>true ).
ENDIF.
IF ls_column_ref-columnname = 'OBJ_NAME' OR
ls_column_ref-columnname = 'DEVCLASS'.
lr_column->set_alignment( if_salv_c_alignment=>left ).
ENDIF.
IF ls_column_ref-columnname = 'OBJ_DESC'.
lr_column->set_alignment( if_salv_c_alignment=>left ).
lr_column->set_short_text( text-c02 ).
lr_column->set_medium_text( text-c02 ).
lr_column->set_long_text( text-c02 ).
ENDIF.
IF ls_column_ref-columnname = 'REMOTE'.
IF p_rfc IS INITIAL.
lr_column->set_visible( if_salv_c_bool_sap=>false ).
ELSE.
lr_column->set_short_text( text-c01 ).
lr_column->set_medium_text( text-c01 ).
lr_column->set_long_text( text-c01 ).
ENDIF.
ENDIF.
ENDLOOP.
*---------- Register ALV Events ----------*
lr_events = go_objects->get_event( ).
CREATE OBJECT lo_event_handler.
SET HANDLER lo_event_handler->on_user_command FOR lr_events.
SET HANDLER lo_event_handler->on_double_click FOR lr_events.
*---------- Display Objects ALV ----------*
go_objects->display( ).
CATCH cx_root. "#EC CATCH_ALL
MESSAGE s001 WITH text-m03 space space space DISPLAY LIKE 'E'.
ENDTRY.
ELSE. "Refresh ALV
go_objects->refresh( ).
ENDIF.
ENDIF.
ENDFORM. " DISPLAY_OBJECTS
*----------------------------------------------------------------------*
* FORMS Adds
*----------------------------------------------------------------------*
*----------------------------------------------------------------------*
* Form CHECK_ADD_OBJECT
*----------------------------------------------------------------------*
FORM check_add_object USING value(i_pgmid) TYPE pgmid
i_object TYPE any
i_obj_n TYPE any
is_env_tab TYPE senvi.
DATA lo_wb_object TYPE REF TO cl_wb_object. "Repository Object
DATA:
ls_tadir TYPE tadir, "Directory of Repository Objects
ls_wb_object_type TYPE wbobjtype, "Global WB Type
ls_object LIKE LINE OF gt_objects. "Objects to transport line
DATA:
lv_tr_object TYPE trobjtype, "Object Type
lv_tr_obj_name TYPE trobj_name, "Object Name in Object List
lv_trans_pgmid TYPE pgmid. "Program ID in Requests and Tasks
*-------------------------------------------------- Object convertions *
IF i_pgmid <> gc_r3tr.
SELECT pgmid UP TO 1 ROWS FROM tadir "#EC CI_GENBUFF
INTO i_pgmid
WHERE object = i_object
AND obj_name = i_obj_n.
ENDSELECT.
*---------- Is not a TADIR object and Conversion required ----------*
IF sy-subrc IS NOT INITIAL.
lv_tr_object = i_object.
lv_tr_obj_name = i_obj_n.
cl_wb_object=>create_from_transport_key( EXPORTING p_object = lv_tr_object
p_obj_name = lv_tr_obj_name
RECEIVING p_wb_object = lo_wb_object
EXCEPTIONS objecttype_not_existing = 1
empty_object_key = 2
key_not_available = 3
OTHERS = 4 ).
IF sy-subrc IS INITIAL.
lo_wb_object->get_global_wb_key( IMPORTING p_object_type = ls_wb_object_type
EXCEPTIONS key_not_available = 1
OTHERS = 2 ).
IF sy-subrc IS INITIAL.
lo_wb_object->get_transport_key( IMPORTING p_pgmid = lv_trans_pgmid "#EC CI_SUBRC
EXCEPTIONS key_not_available = 1
OTHERS = 2 ).
*---------- Check Program ID ----------*
CASE lv_trans_pgmid.
WHEN gc_r3tr. "Main objects
i_pgmid = lv_trans_pgmid.
WHEN 'LIMU'. "Sub object
CALL FUNCTION 'GET_R3TR_OBJECT_FROM_LIMU_OBJ'
EXPORTING
p_limu_objtype = lv_tr_object
p_limu_objname = lv_tr_obj_name
IMPORTING
p_r3tr_objtype = lv_tr_object
p_r3tr_objname = lv_tr_obj_name
EXCEPTIONS
no_mapping = 1
OTHERS = 2.
IF sy-subrc IS INITIAL.
ls_object-pgmid = gc_r3tr.
ls_object-object = lv_tr_object.
ls_object-obj_name = lv_tr_obj_name.
PERFORM add_object USING ls_object.
RETURN.
ENDIF.
WHEN OTHERS. "Include objects
i_pgmid = gc_r3tr.
CALL FUNCTION 'GET_TADIR_TYPE_FROM_WB_TYPE'
EXPORTING
wb_objtype = ls_wb_object_type-subtype_wb
IMPORTING
transport_objtype = lv_tr_object
EXCEPTIONS
no_mapping_found = 1
no_unique_mapping = 2
OTHERS = 3.
IF sy-subrc IS INITIAL.
i_object = lv_tr_object.
IF is_env_tab-encl_obj IS NOT INITIAL.
i_obj_n = is_env_tab-encl_obj.
ENDIF.
ENDIF.
ENDCASE.
ENDIF.
ENDIF.
ENDIF.
ENDIF.
*------------------------------------------------------ Check in TADIR *
SELECT SINGLE * FROM tadir
INTO ls_tadir
WHERE pgmid = i_pgmid
AND object = i_object
AND obj_name = i_obj_n.
*---------------------------------------------------------- Add object *
IF ls_tadir IS NOT INITIAL.
MOVE-CORRESPONDING ls_tadir TO ls_object.
*---------- Set SAP Generated object status ----------*
IF ls_tadir-genflag IS NOT INITIAL.
ls_object-status = icon_led_yellow.
ENDIF.
*---------- Add object to be checked ----------*
PERFORM add_object USING ls_object.
*---------- Error Object not valid ----------*
ELSE.
IF lines( gt_objects ) > 0. "Skip first object
ls_object-pgmid = i_pgmid.
ls_object-object = i_object.
ls_object-obj_name = i_obj_n.
ls_object-status = icon_led_red.
PERFORM add_object USING ls_object.
ENDIF.
ENDIF.
ENDFORM. " CHECK_ADD_OBJECT
*&---------------------------------------------------------------------*
*& Form ADD_OBJECT_HEADER
*&---------------------------------------------------------------------*
FORM add_object_header USING i_pgmid TYPE pgmid
i_object TYPE any
i_obj_n TYPE any
i_objfunc TYPE objfunc.
DATA ls_e071 LIKE LINE OF gt_e071.
READ TABLE gt_e071 TRANSPORTING NO FIELDS WITH KEY pgmid = i_pgmid
object = i_object
obj_name = i_obj_n
objfunc = i_objfunc.
IF sy-subrc IS NOT INITIAL.
ls_e071-pgmid = i_pgmid.
ls_e071-object = i_object.
ls_e071-obj_name = i_obj_n.
ls_e071-objfunc = i_objfunc.
APPEND ls_e071 TO gt_e071.
ENDIF.
ENDFORM. " ADD_OBJECT_HEADER
*&---------------------------------------------------------------------*
*& Form ADD_OBJECT_KEYS
*&---------------------------------------------------------------------*
FORM add_object_keys USING i_pgmid TYPE pgmid
i_object TYPE any
i_obj_n TYPE any
i_tabkey TYPE any.
DATA ls_e071k LIKE LINE OF gt_e071k.
ls_e071k-pgmid = i_pgmid.
ls_e071k-object = i_object.
ls_e071k-objname = i_obj_n.
ls_e071k-mastertype = i_object.
ls_e071k-mastername = i_obj_n.
ls_e071k-tabkey = i_tabkey.
APPEND ls_e071k TO gt_e071k.
ENDFORM. " ADD_OBJECT_KEYS
*&---------------------------------------------------------------------*
*& Form ADD_OBJECT
*&---------------------------------------------------------------------*
FORM add_object USING ps_object TYPE gty_objects.
DATA:
ls_objs_desc LIKE LINE OF gt_objs_desc, "Objects prograns ID line"Info Environment
lt_devclass TYPE scts_devclass, "Development Packages
ls_devclass TYPE trdevclass.
DATA:
lv_object TYPE trobjtype, "Object Type
lv_objname TYPE sobj_name, "Object Name in Object Directory
lv_namespace TYPE namespace. "Object Namespace
*---------- Check if already added ----------*
READ TABLE gt_objects TRANSPORTING NO FIELDS WITH KEY pgmid = ps_object-pgmid
object = ps_object-object
obj_name = ps_object-obj_name.
IF sy-subrc IS NOT INITIAL. "New object
*---------------------------------------- Check if is customer objects *
lv_object = ps_object-object.
lv_objname = ps_object-obj_name.
CALL FUNCTION 'TRINT_GET_NAMESPACE' "#EC FB_RC
EXPORTING
iv_pgmid = ps_object-pgmid
iv_object = lv_object
iv_obj_name = lv_objname
IMPORTING
ev_namespace = lv_namespace
EXCEPTIONS
invalid_prefix = 1
invalid_object_type = 2
OTHERS = 3.
IF lv_namespace = '/0CUST/'. "Is customer object
*---------- Read object description ----------*
READ TABLE gt_objs_desc INTO ls_objs_desc WITH KEY object = ps_object-object.
IF sy-subrc IS INITIAL.
ps_object-obj_desc = ls_objs_desc-text. "Object type description
ENDIF.
*---------- Read development class tecnical information ----------*
IF ps_object-devclass IS INITIAL.
SELECT SINGLE devclass FROM tadir
INTO ps_object-devclass
WHERE pgmid = ps_object-pgmid
AND object = ps_object-object
AND obj_name = ps_object-obj_name.
ENDIF.
IF ps_object-devclass IS NOT INITIAL AND ps_object-devclass <> gc_temp.
ls_devclass-devclass = ps_object-devclass.
APPEND ls_devclass TO lt_devclass.
CALL FUNCTION 'TR_READ_DEVCLASSES'
EXPORTING
it_devclass = lt_devclass
IMPORTING
et_devclass = lt_devclass.
READ TABLE lt_devclass INTO ls_devclass INDEX 1.
IF sy-subrc IS INITIAL.
ps_object-target = ls_devclass-target. "Development package target
ENDIF.
ENDIF.
*---------- Add object to transport ----------*
APPEND ps_object TO gt_objects.
ENDIF.
ENDIF.
ENDFORM. " ADD_OBJECT
*&---------------------------------------------------------------------*
*& Form ADD_TOBJ_CONTENT
*&---------------------------------------------------------------------*
FORM add_tobj_content USING p_obj_name TYPE sobj_name.
CONSTANTS:
lc_tabu TYPE trobjtype VALUE 'TABU',
lc_tvdir TYPE sobj_name VALUE 'TVDIR',
lc_tddat TYPE sobj_name VALUE 'TDDAT',
lc_tvimf TYPE sobj_name VALUE 'TVIMF'.
DATA:
lt_tvimf TYPE TABLE OF tvimf, "User routines called from view maintenance
ls_tvimf LIKE LINE OF lt_tvimf.
DATA lv_tabkey TYPE tabkey. "Table Key
*---------- Add table content ----------*
PERFORM add_object_header USING gc_r3tr lc_tabu lc_tvdir 'K'.
PERFORM add_object_keys USING gc_r3tr lc_tabu lc_tvdir p_obj_name.
CLEAR lt_tvimf. "Read User routines called from view maintenance
SELECT * FROM tvimf "#EC CI_GENBUFF
INTO TABLE lt_tvimf
WHERE tabname = p_obj_name.
LOOP AT lt_tvimf INTO ls_tvimf.
AT FIRST.
PERFORM add_object_header USING gc_r3tr lc_tabu lc_tvimf 'K'.
ENDAT.
lv_tabkey = p_obj_name.
lv_tabkey+30 = ls_tvimf-event.
PERFORM add_object_keys USING gc_r3tr lc_tabu lc_tvimf lv_tabkey.
CLEAR lv_tabkey.
ENDLOOP.
PERFORM add_object_header USING gc_r3tr lc_tabu lc_tddat 'K'.
PERFORM add_object_keys USING gc_r3tr lc_tabu lc_tddat p_obj_name.
ENDFORM. " ADD_TOBJ_CONTENT
*----------------------------------------------------------------------*
* FORMS Checks
*----------------------------------------------------------------------*
*----------------------------------------------------------------------*
* Form OBJECTS_DEPENDENCIES_CHECK
*----------------------------------------------------------------------*
FORM objects_dependencies_check .
DATA:
lv_obj_type TYPE seu_obj, "Object type
lt_env_tab TYPE TABLE OF senvi, "Object to check dependencies
ls_env_tab TYPE senvi. "Info Environment
DATA lv_no_rfc TYPE abap_bool.
FIELD-SYMBOLS <ls_object> LIKE LINE OF gt_objects. "Objects to transport
LOOP AT gt_objects ASSIGNING <ls_object> WHERE status IS INITIAL.
*---------- Exclude RFCs if exist ----------*
IF p_erfc IS NOT INITIAL AND <ls_object>-object = gc_fugr.
CLEAR lv_no_rfc.
PERFORM exclude_rfcs USING <ls_object>-obj_name CHANGING lv_no_rfc.
IF lv_no_rfc IS INITIAL.
<ls_object>-status = icon_led_yellow.
CONTINUE.
ENDIF.
ENDIF.
*---------- Get object dependecies ----------*
REFRESH lt_env_tab.
lv_obj_type = <ls_object>-object.
CALL FUNCTION 'REPOSITORY_ENVIRONMENT_RFC'
EXPORTING
obj_type = lv_obj_type
object_name = <ls_object>-obj_name
TABLES
environment_tab = lt_env_tab.
IF lines( lt_env_tab ) IS INITIAL AND lines( gt_objects ) = 1. "Object dependencies check not support
MESSAGE s001 WITH text-m13 space space space DISPLAY LIKE 'E'.
<ls_object>-status = icon_led_red.
ELSE.
DELETE lt_env_tab INDEX 1. "Delete first line
*---------- Add founded dependecies ----------*
LOOP AT lt_env_tab INTO ls_env_tab. "#EC CI_NESTED
PERFORM check_add_object USING space ls_env_tab-type ls_env_tab-object ls_env_tab.
ENDLOOP.
<ls_object>-status = icon_led_green. "Status checked
ENDIF.
ENDLOOP.
ENDFORM. " OBJECTS_DEPENDENCIES_CHECK
*----------------------------------------------------------------------*
* Form REMOTE_OBJECTS_CHECK
*----------------------------------------------------------------------*
FORM remote_objects_check .
FIELD-SYMBOLS <ls_object> LIKE LINE OF gt_objects. "Objects to transport
DATA:
ls_e071 TYPE e071, "Change & Transport System: Object Entries of Requests/Tasks
lt_vrso TYPE TABLE OF vrso, "Version control: Object list (subset of VRSD)
ls_vrso LIKE LINE OF lt_vrso.
DATA:
lv_diagnosis TYPE char20, "Version check result
lv_local_rfc_dest TYPE rfcdest, "Logical Destination
lv_remote_rfc_dest TYPE rfcdest.
*---------- Get local rfc destination ----------*
SELECT desadm FROM tmscsys UP TO 1 ROWS "#EC CI_NOFIRST
INTO lv_local_rfc_dest
WHERE sysnam = sy-sysid.
ENDSELECT.
*---------- Get remote rfc destination ----------*
SELECT desadm FROM tmscsys UP TO 1 ROWS "#EC CI_NOFIRST
INTO lv_remote_rfc_dest
WHERE sysnam = p_rfc_d.
ENDSELECT.
*---------- Check objects versions ----------*
IF lv_local_rfc_dest IS NOT INITIAL AND lv_remote_rfc_dest IS NOT INITIAL.
LOOP AT gt_objects ASSIGNING <ls_object>.
*---------- Get Sub Objects ----------*
ls_e071-object = <ls_object>-object.
ls_e071-obj_name = <ls_object>-obj_name.
REFRESH lt_vrso.
CALL FUNCTION 'TRINT_RESOLVE_OBJ'
EXPORTING
is_e071 = ls_e071
TABLES
et_vrso = lt_vrso
EXCEPTIONS
not_versionable = 1
communication_error = 2
OTHERS = 3.
IF sy-subrc IS INITIAL.
*---------- Remote check all objects and subobjects ----------*
LOOP AT lt_vrso INTO ls_vrso WHERE objtype <> 'DOCU'. "#EC CI_NESTED
CLEAR lv_diagnosis.
CALL FUNCTION 'TRINT_COMP_VERSION'
EXPORTING
is_vrso = ls_vrso
dest1 = lv_local_rfc_dest
dest2 = lv_remote_rfc_dest
IMPORTING
ev_diagnosis = lv_diagnosis
EXCEPTIONS
rfc_error_loc = 1
rfc_error_rem = 2
intern_error_loc = 3
intern_error_rem = 4
OTHERS = 5.
IF sy-subrc IS INITIAL.
CASE lv_diagnosis.
WHEN 0. "Equal
<ls_object>-remote = text-o01.
WHEN 1. "Different
<ls_object>-remote = text-o02.
EXIT.
WHEN 3. "New
<ls_object>-remote = text-o03.
EXIT.
ENDCASE.
ENDIF.
ENDLOOP.
ELSE. "Not versionable
<ls_object>-remote = text-o04.
ENDIF.
ENDLOOP.
ELSE. "RFCs destinations missing
MESSAGE s001 WITH text-m09 space space space DISPLAY LIKE 'W'.
ENDIF.
ENDFORM. " REMOTE_OBJECTS_CHECK
*&---------------------------------------------------------------------*
*& Form INCLUDE_MAINTENANCES
*&---------------------------------------------------------------------*
FORM include_maintenances .
DATA:
ls_tvdir TYPE tvdir, "View Directory
ls_object LIKE LINE OF gt_objects, "Objects to transport line
ls_object_add LIKE LINE OF gt_objects.
DATA:
lv_obj_type TYPE c,
lv_tobj_name TYPE sobj_name, "Object Name in Object Directory
lv_objectname TYPE ob_object. "Object Name
LOOP AT gt_objects INTO ls_object WHERE object = gc_tabl AND status = icon_led_green.
CLEAR ls_tvdir.
SELECT SINGLE * FROM tvdir "#EC CI_SEL_NESTED
INTO ls_tvdir
WHERE tabname = ls_object-obj_name.
IF sy-subrc IS INITIAL.
*---------- Add Function Group if exist ----------*
ls_object_add-pgmid = gc_r3tr.
ls_object_add-object = gc_fugr.
ls_object_add-obj_name = ls_tvdir-area.
PERFORM add_object USING ls_object_add.
IF ls_tvdir-bastab IS INITIAL. lv_obj_type = 'V'. ELSE. lv_obj_type = 'S'. ENDIF.
*---------- Add Definition of a Maintenance and Transport Object ----------*
CLEAR lv_tobj_name.
lv_objectname = ls_object-obj_name.
CALL FUNCTION 'CTO_OBJECT_GET_TADIR_KEY'
EXPORTING
iv_objectname = lv_objectname
iv_objecttype = lv_obj_type
IMPORTING
ev_obj_name = lv_tobj_name.
ls_object_add-pgmid = gc_r3tr.
ls_object_add-object = gc_tobj.
ls_object_add-obj_name = lv_tobj_name.
ls_object_add-status = icon_led_green.
PERFORM add_object USING ls_object_add.
ENDIF.
ENDLOOP.
ENDFORM. " INCLUDE_MAINTENANCES
*&---------------------------------------------------------------------*
*& Form INCLUDE_LOCKS
*&---------------------------------------------------------------------*
FORM include_locks .
DATA:
ls_object LIKE LINE OF gt_objects, "Objects to transport line
ls_object_add LIKE LINE OF gt_objects.
DATA lv_viewname TYPE viewname.
*---------- Add lock objects if exist ----------*
LOOP AT gt_objects INTO ls_object WHERE object = gc_tabl AND status = icon_led_green.
CLEAR lv_viewname.
SELECT viewname FROM dd25l UP TO 1 ROWS "#EC CI_SEL_NESTED "#EC CI_NOFIRST
INTO lv_viewname
WHERE aggtype = 'E'
AND roottab = ls_object-obj_name.
ENDSELECT.
IF sy-subrc IS INITIAL.
ls_object_add-pgmid = gc_r3tr.
ls_object_add-object = 'ENQU'.
ls_object_add-obj_name = lv_viewname.
ls_object_add-status = icon_led_green.
PERFORM add_object USING ls_object_add.
ENDIF.
ENDLOOP.
ENDFORM. " INCLUDE_LOCKS
*&---------------------------------------------------------------------*
*& Form INCLUDE_CDS
*&---------------------------------------------------------------------*
FORM include_cds .
DATA:
ls_object LIKE LINE OF gt_objects, "Objects to transport line
ls_object_add LIKE LINE OF gt_objects.
DATA lv_object TYPE cdobjectcl.
*---------- Add change document object if exist ----------*
LOOP AT gt_objects INTO ls_object WHERE object = gc_tabl AND status = icon_led_green.
CLEAR lv_object.
SELECT object FROM tcdob UP TO 1 ROWS "#EC CI_SEL_NESTED "#EC CI_GENBUFF
INTO lv_object
WHERE tabname = ls_object-obj_name.
ENDSELECT.
IF sy-subrc IS INITIAL.
ls_object_add-pgmid = gc_r3tr.
ls_object_add-object = gc_chdo.
ls_object_add-obj_name = lv_object.
ls_object_add-status = icon_led_green.
PERFORM add_object USING ls_object_add.
ENDIF.
ENDLOOP.
ENDFORM. " INCLUDE_CDS
*&---------------------------------------------------------------------*
*& Form EXCLUDE_RFCS
*&---------------------------------------------------------------------*
FORM exclude_rfcs USING p_obj_name TYPE sobj_name
CHANGING p_no_rfc TYPE abap_bool.
DATA lt_fbinfo_remote TYPE TABLE OF fbinfor. "Function Module Information
DATA lv_complete_area TYPE rs38l_area. "Function group, to which the function module belongs
*---------- Check if all are RFCs ----------*
lv_complete_area = p_obj_name.
CALL FUNCTION 'FUNCTION_SELECT_TFDIR' "#EC FB_RC
EXPORTING
im_complete_area = lv_complete_area
IMPORTING
ex_fbinfo_remote = lt_fbinfo_remote
EXCEPTIONS
include_not_found_trdir = 1
report_source_not_found = 2
permission_failure = 3
OTHERS = 4.
LOOP AT lt_fbinfo_remote TRANSPORTING NO FIELDS WHERE remote <> 'R'.
p_no_rfc = abap_true. "One function found that are not RFCs
EXIT.
ENDLOOP.
ENDFORM. " EXCLUDE_RFCS
Selection screen layout after implementation:
Result objects list layout:
Please consider before using:
- This tool is not full tested and is not possible to ensure that all repository workbench objects can be checked or dependencies detected. Please give feedback if you notice missing objects to be improved.
- Only objects inside customer scope /0CUST/ are detected and checked. All standard objects are excluded because they are not relevant for transport and performance is significantly improved.
- ZNM_OBJS_DEP_TRANS works with most common and used objects. Exotic objects like Sapscript, Smart forms, IDOCs, Workflows and others for the moment are not fully supported.
- For complex and big developments you should use it as an auxiliary tool and kept in mind that your brain is still needed to validate and create coherent transports.
- You should have some technical background and ABAP knowledge to use and understand how to take full advantage of it.
- Dependencies result objects list only includes main objects to be transported. This mean that for example if a function module and/or class method are detected the full function group and class are included and not their sub-objects. The same for special SAP code generated objects, only main objects are included because they are generated at import step and should not be transported.
- You can only include in one transport request objects with green status with a valid development package and belonging to the same target. Objects with yellow status are ignored and not relevant but for red status a manual check is required to avoid transport problems.
- Development packages and tables data are not displayed on dependencies result list and are added directly to transport request.
How to use:
- Fill object selection using main objects like Tables, Programs, Classes, Functions Groups, etc to be checked.
Example to check dependencies in program ZNM_OBJS_DEP_TRANS:
- If you need to detected objects changes in destination system please flag Cross-system objects version check:
- Flag additional options if needed to include or exclude specials objects:
- Include Tables Maintenances: If exist in detected tables function groups and related table maintenance objects are included;
- Include Tables Locks: If exist in detected tables lock objects are included;
- Include Tables CDs: If exist in detected tables change documents are included;
- Exclude RFCs if exist: Depending of your SAP systems landscape this option can be useful to exclude RFCs functions modules.
- Double click on each result row to direct object editor navigation.