Object name | Object type | Description | ||
ZCL_STCT_GW_SRV_MASS_MAINT | class | This class is used by the new mass maintenance task. It inherits from the class CL_STCTM_REPORT_UI so that the report ZR_STCT_UI_MAINT_GW_SERVICES can be used as a UI to enter parameters. | ||
ZR_STCT_UI_MAINT_GW_SERVICES | report | This report is called in the constructor of the above mentioned class ZCL_STCT_GW_SRV_MASS_MAINT. | ||
ZCL_GATEWAY_SERVICE | class | Class that performs the SAP Gateway service maintenance. It is called by the class ZCL_STCT_GW_SRV_MASS_MAINT in method IF_STCTM_BG_TASK~EXECUTE |
CLASS zcl_gateway_service DEFINITION
PUBLIC
FINAL
CREATE PUBLIC .
PUBLIC SECTION.
METHODS add_alias
IMPORTING iv_transport_cust TYPE trkorr OPTIONAL
iv_system_alias TYPE /iwfnd/defi_system_alias
iv_user_role TYPE /iwfnd/defi_role_name OPTIONAL
iv_is_default TYPE abap_bool OPTIONAL
iv_is_def_for_meta TYPE /iwfnd/mgw_inma_def_alias_meta OPTIONAL
RAISING /iwfnd/cx_cof .
METHODS remove_alias
IMPORTING iv_transport_cust TYPE trkorr OPTIONAL
iv_system_alias TYPE /iwfnd/defi_system_alias
iv_user_role TYPE /iwfnd/defi_role_name OPTIONAL
RAISING /iwfnd/cx_cof .
METHODS constructor
IMPORTING iv_service_id TYPE /iwfnd/med_mdl_srg_identifier
RAISING /iwfnd/cx_cof.
METHODS get_service_id
RETURNING VALUE(rv_service_id) TYPE /iwfnd/med_mdl_srg_identifier
RAISING /iwfnd/cx_cof.
METHODS get_service_group
RETURNING VALUE(rv_service_group) TYPE /iwfnd/cl_med_rem_exploration=>ty_s_service_group
RAISING /iwfnd/cx_cof.
METHODS delete
IMPORTING iv_transport_cust TYPE trkorr DEFAULT space
iv_transport_dev TYPE trkorr DEFAULT space
RAISING /iwfnd/cx_cof .
METHODS remove_all_aliases
IMPORTING iv_transport_cust TYPE trkorr OPTIONAL
RAISING /iwfnd/cx_cof.
METHODS get_aliases
RETURNING VALUE(rt_system_aliases) TYPE /iwfnd/cl_cof_facade=>ty_gt_system_aliases
RAISING /iwfnd/cx_cof .
METHODS assign_aliases_from_service
IMPORTING iv_template_service_id TYPE /iwfnd/med_mdl_srg_identifier
iv_transport_cust TYPE trkorr OPTIONAL
RAISING /iwfnd/cx_cof.
METHODS set_to_codeployed
IMPORTING iv_transport_cust TYPE trkorr OPTIONAL
iv_transport_dev TYPE trkorr OPTIONAL
RAISING /iwfnd/cx_cof.
METHODS set_to_routing_based
IMPORTING iv_transport_cust TYPE trkorr OPTIONAL
iv_transport_dev TYPE trkorr OPTIONAL
RAISING /iwfnd/cx_cof..
PROTECTED SECTION.
PRIVATE SECTION.
DATA: mv_service_id TYPE /iwfnd/med_mdl_srg_identifier , "service id
mv_record_customizing TYPE abap_bool,
mv_record_workbench TYPE abap_bool.
TYPES:
BEGIN OF root_cause_textid,
msgid TYPE symsgid,
msgno TYPE symsgno,
attr1 TYPE scx_attrname,
attr2 TYPE scx_attrname,
attr3 TYPE scx_attrname,
attr4 TYPE scx_attrname,
END OF root_cause_textid.
METHODS does_alias_exist
IMPORTING iv_system_alias TYPE /iwfnd/defi_system_alias
RETURNING VALUE(ev_active) TYPE abap_bool
RAISING /iwfnd/cx_cof.
METHODS get_root_cause_exception
EXPORTING
ev_root_cause_textid TYPE zcl_gateway_service=>root_cause_textid
CHANGING
cx_previous TYPE REF TO cx_root.
METHODS set_process_mode
IMPORTING
iv_process_mode TYPE /iwfnd/med_process_mode
"iv_system_alias TYPE /iwfnd/defi_system_alias OPTIONAL
iv_transport_cust TYPE trkorr OPTIONAL
iv_transport_dev TYPE trkorr OPTIONAL
RAISING /iwfnd/cx_cof.
METHODS check_system_change_options
RAISING /iwfnd/cx_cof.
ENDCLASS.
CLASS ZCL_GATEWAY_SERVICE IMPLEMENTATION.
* <SIGNATURE>---------------------------------------------------------------------------------------+
* | Instance Public Method ZCL_GATEWAY_SERVICE->ADD_ALIAS
* +-------------------------------------------------------------------------------------------------+
* | [--->] IV_TRANSPORT_CUST TYPE TRKORR(optional)
* | [--->] IV_SYSTEM_ALIAS TYPE /IWFND/DEFI_SYSTEM_ALIAS
* | [--->] IV_USER_ROLE TYPE /IWFND/DEFI_ROLE_NAME(optional)
* | [--->] IV_IS_DEFAULT TYPE ABAP_BOOL(optional)
* | [--->] IV_IS_DEF_FOR_META TYPE /IWFND/MGW_INMA_DEF_ALIAS_META(optional)
* | [!CX!] /IWFND/CX_COF
* +--------------------------------------------------------------------------------------</SIGNATURE>
METHOD add_alias.
DATA: ls_root_cause_textid TYPE root_cause_textid,
lv_process_mode TYPE /iwfnd/med_process_mode,
lo_config_facade TYPE REF TO /iwfnd/cl_cof_facade,
lx_previous TYPE REF TO cx_root.
IF mv_record_customizing = abap_true AND iv_transport_cust IS INITIAL.
CLEAR ls_root_cause_textid.
ls_root_cause_textid-attr1 = iv_system_alias && ' cannot be assigned because no customizing request has been provided'.
ls_root_cause_textid-msgid = '/IWFND/CM_COS'.
ls_root_cause_textid-msgno = 163.
RAISE EXCEPTION TYPE /iwfnd/cx_cof
EXPORTING
textid = ls_root_cause_textid.
ENDIF.
IF does_alias_exist( iv_system_alias ) = abap_true.
TRY.
lv_process_mode = me->get_service_group( )-process_mode.
"system aliases shall only be assigned to services that are routing based
IF lv_process_mode <> /iwfnd/if_mgw_core_types=>gcs_process_mode-routing_based.
CLEAR ls_root_cause_textid.
ls_root_cause_textid-attr1 = iv_system_alias && ' cannot be assigned because ' && mv_service_id && ' is not routing based'.
ls_root_cause_textid-msgid = '/IWFND/CM_COS'.
ls_root_cause_textid-msgno = 163.
RAISE EXCEPTION TYPE /iwfnd/cx_cof
EXPORTING
textid = ls_root_cause_textid.
ENDIF.
lo_config_facade = /iwfnd/cl_cof_facade=>get_instance( ).
lo_config_facade->assign_sys_alias_to_srv(
EXPORTING
iv_transport_cust = iv_transport_cust " Request/Task
iv_srg_identifier = mv_service_id " Service Document Identifier
iv_system_alias = iv_system_alias " SAP System Alias
iv_user_role = iv_user_role " Name of a User Role
iv_is_default = iv_is_default " System Alias is default - Used for Create and Metadata
iv_is_def_for_meta = iv_is_def_for_meta" System Alias is default for metadata (";mo" scenarios only)
).
CATCH cx_root INTO lx_previous.
get_root_cause_exception(
IMPORTING
ev_root_cause_textid = ls_root_cause_textid
CHANGING
cx_previous = lx_previous ).
RAISE EXCEPTION TYPE /iwfnd/cx_cof
EXPORTING
textid = ls_root_cause_textid.
ENDTRY.
ELSE.
CLEAR ls_root_cause_textid.
"System alias '&1' is not available
ls_root_cause_textid-msgid = '/IWFND/CM_MGW'.
ls_root_cause_textid-msgno = 13.
ls_root_cause_textid-attr1 = iv_system_alias.
RAISE EXCEPTION TYPE /iwfnd/cx_cof
EXPORTING
textid = ls_root_cause_textid.
ENDIF.
ENDMETHOD.
* <SIGNATURE>---------------------------------------------------------------------------------------+
* | Instance Public Method ZCL_GATEWAY_SERVICE->ASSIGN_ALIASES_FROM_SERVICE
* +-------------------------------------------------------------------------------------------------+
* | [--->] IV_TEMPLATE_SERVICE_ID TYPE /IWFND/MED_MDL_SRG_IDENTIFIER
* | [--->] IV_TRANSPORT_CUST TYPE TRKORR(optional)
* | [!CX!] /IWFND/CX_COF
* +--------------------------------------------------------------------------------------</SIGNATURE>
METHOD assign_aliases_from_service.
DATA: ls_root_cause_textid TYPE root_cause_textid,
lt_system_aliases TYPE /iwfnd/cl_cof_facade=>ty_gt_system_aliases,
ls_system_aliases TYPE /iwfnd/cl_cof_facade=>ty_gs_system_alias,
lo_config_facade TYPE REF TO /iwfnd/cl_cof_facade,
lv_srg_identifier TYPE /iwfnd/med_mdl_srg_identifier,
lx_previous TYPE REF TO cx_root.
"-check whether service group from which aliases shall be copied does exist
SELECT SINGLE srv_identifier FROM /iwfnd/i_med_srh
INTO @lv_srg_identifier
WHERE srv_identifier = @iv_template_service_id.
IF sy-subrc NE 0.
CLEAR ls_root_cause_textid.
ls_root_cause_textid-attr1 = 'template service:' && iv_template_service_id && ' does not exist.'.
ls_root_cause_textid-msgid = '/IWFND/CM_COS'.
ls_root_cause_textid-msgno = 163.
RAISE EXCEPTION TYPE /iwfnd/cx_cof
EXPORTING
textid = ls_root_cause_textid.
ENDIF.
IF mv_record_customizing = abap_true AND iv_transport_cust IS INITIAL.
CLEAR ls_root_cause_textid.
ls_root_cause_textid-attr1 = 'Aliases from ' && iv_template_service_id && ' cannot be assigned to ' && mv_service_id && ' because no customizing request has been provided'.
ls_root_cause_textid-msgid = '/IWFND/CM_COS'.
ls_root_cause_textid-msgno = 163.
RAISE EXCEPTION TYPE /iwfnd/cx_cof
EXPORTING
textid = ls_root_cause_textid.
ENDIF.
"retrieve system alias assignment from template service
TRY.
lo_config_facade = /iwfnd/cl_cof_facade=>get_instance( ).
lt_system_aliases = lo_config_facade->get_sys_aliases_of_srv( iv_service_id = iv_template_service_id ).
IF lt_system_aliases IS INITIAL.
CLEAR ls_root_cause_textid.
ls_root_cause_textid-attr1 = iv_template_service_id && ' : has no aliases assigned.'.
ls_root_cause_textid-msgid = '/IWFND/CM_COS'.
ls_root_cause_textid-msgno = 163.
RAISE EXCEPTION TYPE /iwfnd/cx_cof
EXPORTING
textid = ls_root_cause_textid.
ENDIF.
"remove all aliases from our service
me->remove_all_aliases(
iv_transport_cust = iv_transport_cust
).
"add aliases from template service
LOOP AT lt_system_aliases INTO ls_system_aliases.
me->add_alias(
EXPORTING
iv_transport_cust = iv_transport_cust
iv_system_alias = ls_system_aliases-system_alias
iv_user_role = ls_system_aliases-user_role
iv_is_default = ls_system_aliases-is_default
iv_is_def_for_meta = ls_system_aliases-is_def_for_meta
).
ENDLOOP.
CATCH cx_root INTO lx_previous.
get_root_cause_exception(
IMPORTING
ev_root_cause_textid = ls_root_cause_textid
CHANGING
cx_previous = lx_previous ).
RAISE EXCEPTION TYPE /iwfnd/cx_cof
EXPORTING
textid = ls_root_cause_textid.
ENDTRY.
ENDMETHOD.
* <SIGNATURE>---------------------------------------------------------------------------------------+
* | Instance Private Method ZCL_GATEWAY_SERVICE->CHECK_SYSTEM_CHANGE_OPTIONS
* +-------------------------------------------------------------------------------------------------+
* | [!CX!] /IWFND/CX_COF
* +--------------------------------------------------------------------------------------</SIGNATURE>
METHOD check_system_change_options.
DATA: lv_systemedit TYPE edtflag,
lv_systemname TYPE syst_sysid,
lv_systemtype TYPE syst_sysid,
lv_system_client_edit TYPE cccoractiv,
lv_sys_cliinddep_edit TYPE ccnocliind,
lv_sytem_client_role TYPE cccategory.
DATA ls_root_cause_textid TYPE root_cause_textid.
CALL FUNCTION 'TR_SYS_PARAMS'
IMPORTING
systemedit = lv_systemedit
systemname = lv_systemname "System Name (e.g. C11)
systemtype = lv_systemtype "Type ('SAP' or 'CUSTOMER')
system_client_edit = lv_system_client_edit "Change Option for Client-Dependent Customizing Objects
sys_cliinddep_edit = lv_sys_cliinddep_edit "Change Option for Repository Objects in Logon Client
system_client_role = lv_sytem_client_role
EXCEPTIONS
no_systemname = 1
no_systemtype = 2
OTHERS = 3.
IF sy-subrc <> 0.
CLEAR ls_root_cause_textid.
IF sy-subrc = 2.
ls_root_cause_textid-attr1 = 'System has no system name'.
ELSEIF sy-subrc = 3.
ls_root_cause_textid-attr1 = 'System has no system type ("SAP" or "CUSTOMER")'.
ELSE.
ls_root_cause_textid-attr1 = 'Error when calling TR_SYS_PARAMS'.
ENDIF.
ls_root_cause_textid-msgid = '/IWFND/CM_COS'.
ls_root_cause_textid-msgno = 163.
RAISE EXCEPTION TYPE /iwfnd/cx_cof
EXPORTING
textid = ls_root_cause_textid.
ENDIF.
"' ' No automatic recording of changes for transport
"'1' Changes are recorded in transport request
"'2' Customizing in this client cannot be changed
"'3' Customizing: Can be changed as req., but cannot be transp.
IF lv_system_client_edit = '1'.
mv_record_customizing = abap_true.
ELSE. " at '' '2' and '3' changes are note recorded in a customizing request
mv_record_customizing = abap_false.
ENDIF.
IF lv_system_client_edit = '2'.
CLEAR ls_root_cause_textid.
ls_root_cause_textid-attr1 = 'No changes to customizing allowed'.
ls_root_cause_textid-msgid = '/IWFND/CM_COS'.
ls_root_cause_textid-msgno = 163.
RAISE EXCEPTION TYPE /iwfnd/cx_cof
EXPORTING
textid = ls_root_cause_textid.
ENDIF.
"' ' Changes to Repository and cross-client Customizing allowed
"'1' No changes to cross-client Customizing objects
"'2' No changes to Repository objects
"'3' No changes to Repository and cross-client Customizing objs
IF lv_sys_cliinddep_edit = ' '.
mv_record_workbench = abap_true.
ELSE.
mv_record_workbench = abap_false.
ENDIF.
IF lv_sys_cliinddep_edit = '2' OR lv_sys_cliinddep_edit = '3'.
CLEAR ls_root_cause_textid.
ls_root_cause_textid-attr1 = 'No changes to repository objects allowed'.
ls_root_cause_textid-msgid = '/IWFND/CM_COS'.
ls_root_cause_textid-msgno = 163.
RAISE EXCEPTION TYPE /iwfnd/cx_cof
EXPORTING
textid = ls_root_cause_textid.
ENDIF.
ENDMETHOD.
* <SIGNATURE>---------------------------------------------------------------------------------------+
* | Instance Public Method ZCL_GATEWAY_SERVICE->CONSTRUCTOR
* +-------------------------------------------------------------------------------------------------+
* | [--->] IV_SERVICE_ID TYPE /IWFND/MED_MDL_SRG_IDENTIFIER
* | [!CX!] /IWFND/CX_COF
* +--------------------------------------------------------------------------------------</SIGNATURE>
METHOD constructor.
DATA : lv_srg_identifier TYPE /iwfnd/med_mdl_srg_identifier .
"-check whether service group exists
SELECT SINGLE srv_identifier FROM /iwfnd/i_med_srh
INTO @lv_srg_identifier
WHERE srv_identifier = @iv_service_id.
IF sy-subrc EQ 0.
mv_service_id = iv_service_id.
ELSE.
RAISE EXCEPTION TYPE /iwfnd/cx_cof
EXPORTING
textid = /iwfnd/cx_cof=>service_grp_does_not_exist.
ENDIF.
me->check_system_change_options( ).
ENDMETHOD.
* <SIGNATURE>---------------------------------------------------------------------------------------+
* | Instance Public Method ZCL_GATEWAY_SERVICE->DELETE
* +-------------------------------------------------------------------------------------------------+
* | [--->] IV_TRANSPORT_CUST TYPE TRKORR (default =SPACE)
* | [--->] IV_TRANSPORT_DEV TYPE TRKORR (default =SPACE)
* | [!CX!] /IWFND/CX_COF
* +--------------------------------------------------------------------------------------</SIGNATURE>
METHOD delete.
DATA: ls_root_cause_textid TYPE root_cause_textid,
lo_config_facade TYPE REF TO /iwfnd/cl_cof_facade,
lx_previous TYPE REF TO cx_root.
IF ( mv_record_customizing = abap_true AND iv_transport_cust IS INITIAL ).
CLEAR ls_root_cause_textid.
ls_root_cause_textid-attr1 = mv_service_id && ' cannot be deleted because no customizing request has been provided'.
ls_root_cause_textid-msgid = '/IWFND/CM_COS'.
ls_root_cause_textid-msgno = 163.
RAISE EXCEPTION TYPE /iwfnd/cx_cof
EXPORTING
textid = ls_root_cause_textid.
ENDIF.
IF ( mv_record_workbench = abap_true AND iv_transport_dev IS INITIAL ) .
CLEAR ls_root_cause_textid.
ls_root_cause_textid-attr1 = mv_service_id && ' cannot be deleted because no workbench request has been provided'.
ls_root_cause_textid-msgid = '/IWFND/CM_COS'.
ls_root_cause_textid-msgno = 163.
RAISE EXCEPTION TYPE /iwfnd/cx_cof
EXPORTING
textid = ls_root_cause_textid.
ENDIF.
TRY.
lo_config_facade = /iwfnd/cl_cof_facade=>get_instance( ).
lo_config_facade->deactivate_service(
EXPORTING
iv_service_identifier = mv_service_id
iv_transport_dev = iv_transport_dev
iv_transport_cust = iv_transport_cust
).
CATCH cx_root INTO lx_previous.
get_root_cause_exception(
IMPORTING
ev_root_cause_textid = ls_root_cause_textid
CHANGING
cx_previous = lx_previous ).
RAISE EXCEPTION TYPE /iwfnd/cx_cof
EXPORTING
textid = ls_root_cause_textid.
ENDTRY.
ENDMETHOD.
* <SIGNATURE>---------------------------------------------------------------------------------------+
* | Instance Private Method ZCL_GATEWAY_SERVICE->DOES_ALIAS_EXIST
* +-------------------------------------------------------------------------------------------------+
* | [--->] IV_SYSTEM_ALIAS TYPE /IWFND/DEFI_SYSTEM_ALIAS
* | [<-()] EV_ACTIVE TYPE ABAP_BOOL
* | [!CX!] /IWFND/CX_COF
* +--------------------------------------------------------------------------------------</SIGNATURE>
METHOD does_alias_exist.
DATA : ls_dfsyal TYPE /iwfnd/c_dfsyal.
"Check if system alias does exist
SELECT SINGLE *
FROM /iwfnd/c_dfsyal
INTO @ls_dfsyal
WHERE system_alias = @iv_system_alias.
IF ( sy-subrc = 0 ). "System alias exists
ev_active = abap_true.
ELSE.
ev_active = abap_false.
ENDIF.
ENDMETHOD.
* <SIGNATURE>---------------------------------------------------------------------------------------+
* | Instance Public Method ZCL_GATEWAY_SERVICE->GET_ALIASES
* +-------------------------------------------------------------------------------------------------+
* | [<-()] RT_SYSTEM_ALIASES TYPE /IWFND/CL_COF_FACADE=>TY_GT_SYSTEM_ALIASES
* | [!CX!] /IWFND/CX_COF
* +--------------------------------------------------------------------------------------</SIGNATURE>
METHOD get_aliases.
DATA: ls_root_cause_textid TYPE root_cause_textid,
lo_config_facade TYPE REF TO /iwfnd/cl_cof_facade,
lx_previous TYPE REF TO cx_root.
TRY.
lo_config_facade = /iwfnd/cl_cof_facade=>get_instance( ).
rt_system_aliases = lo_config_facade->get_sys_aliases_of_srv( iv_service_id = mv_service_id ).
CATCH cx_root INTO lx_previous.
get_root_cause_exception(
IMPORTING
ev_root_cause_textid = ls_root_cause_textid
CHANGING
cx_previous = lx_previous ).
RAISE EXCEPTION TYPE /iwfnd/cx_cof
EXPORTING
textid = ls_root_cause_textid.
ENDTRY.
ENDMETHOD.
* <SIGNATURE>---------------------------------------------------------------------------------------+
* | Instance Private Method ZCL_GATEWAY_SERVICE->GET_ROOT_CAUSE_EXCEPTION
* +-------------------------------------------------------------------------------------------------+
* | [<---] EV_ROOT_CAUSE_TEXTID TYPE ZCL_GATEWAY_SERVICE=>ROOT_CAUSE_TEXTID
* | [<-->] CX_PREVIOUS TYPE REF TO CX_ROOT
* +--------------------------------------------------------------------------------------</SIGNATURE>
METHOD get_root_cause_exception.
DATA lx_root_cause TYPE REF TO /iwfnd/cx_base.
"the caller of this class should retrieve an error message of the root cause
"that has been originally raised by the config facade
IF cx_previous->previous IS NOT INITIAL .
WHILE cx_previous->previous IS NOT INITIAL ."BOUND.
cx_previous = cx_previous->previous. " Get the exception that caused this exception
TRY.
lx_root_cause ?= cx_previous.
CATCH cx_sy_move_cast_error.
ENDTRY.
ENDWHILE.
ev_root_cause_textid-attr1 = lx_root_cause->get_longtext( ).
ELSE.
ev_root_cause_textid-attr1 = cx_previous->get_longtext( ).
ENDIF.
ev_root_cause_textid-msgid = '/IWFND/CM_COS'.
ev_root_cause_textid-msgno = 163.
ENDMETHOD.
* <SIGNATURE>---------------------------------------------------------------------------------------+
* | Instance Public Method ZCL_GATEWAY_SERVICE->GET_SERVICE_GROUP
* +-------------------------------------------------------------------------------------------------+
* | [<-()] RV_SERVICE_GROUP TYPE /IWFND/CL_MED_REM_EXPLORATION=>TY_S_SERVICE_GROUP
* | [!CX!] /IWFND/CX_COF
* +--------------------------------------------------------------------------------------</SIGNATURE>
METHOD get_service_group.
DATA : ls_srg_header TYPE /iwfnd/i_med_srh .
SELECT SINGLE * FROM /iwfnd/i_med_srh
INTO @ls_srg_header
WHERE srv_identifier = @mv_service_id.
IF sy-subrc NE 0.
RAISE EXCEPTION TYPE /iwfnd/cx_cof
EXPORTING
textid = /iwfnd/cx_cof=>service_grp_does_not_exist.
ENDIF.
rv_service_group-technical_name = ls_srg_header-object_name.
rv_service_group-namespace = ls_srg_header-namespace.
rv_service_group-external_name = ls_srg_header-service_name.
rv_service_group-version = ls_srg_header-service_version.
rv_service_group-is_sap_service = ls_srg_header-is_sap_service.
rv_service_group-soft_state_status = ls_srg_header-soft_state_stat.
rv_service_group-process_mode = ls_srg_header-process_mode.
ENDMETHOD.
* <SIGNATURE>---------------------------------------------------------------------------------------+
* | Instance Public Method ZCL_GATEWAY_SERVICE->GET_SERVICE_ID
* +-------------------------------------------------------------------------------------------------+
* | [<-()] RV_SERVICE_ID TYPE /IWFND/MED_MDL_SRG_IDENTIFIER
* | [!CX!] /IWFND/CX_COF
* +--------------------------------------------------------------------------------------</SIGNATURE>
METHOD get_service_id.
rv_service_id = me->mv_service_id.
ENDMETHOD.
* <SIGNATURE>---------------------------------------------------------------------------------------+
* | Instance Public Method ZCL_GATEWAY_SERVICE->REMOVE_ALIAS
* +-------------------------------------------------------------------------------------------------+
* | [--->] IV_TRANSPORT_CUST TYPE TRKORR(optional)
* | [--->] IV_SYSTEM_ALIAS TYPE /IWFND/DEFI_SYSTEM_ALIAS
* | [--->] IV_USER_ROLE TYPE /IWFND/DEFI_ROLE_NAME(optional)
* | [!CX!] /IWFND/CX_COF
* +--------------------------------------------------------------------------------------</SIGNATURE>
METHOD remove_alias.
DATA: ls_root_cause_textid TYPE root_cause_textid,
lo_config_facade TYPE REF TO /iwfnd/cl_cof_facade,
lx_previous TYPE REF TO cx_root.
IF mv_record_customizing = abap_true AND iv_transport_cust IS INITIAL.
CLEAR ls_root_cause_textid.
ls_root_cause_textid-attr1 = iv_system_alias && ' cannot be removed from ' && mv_service_id && ' because no customizing request has been provided'.
ls_root_cause_textid-msgid = '/IWFND/CM_COS'.
ls_root_cause_textid-msgno = 163.
RAISE EXCEPTION TYPE /iwfnd/cx_cof
EXPORTING
textid = ls_root_cause_textid.
ENDIF.
IF does_alias_exist( iv_system_alias ) = abap_true.
TRY.
lo_config_facade = /iwfnd/cl_cof_facade=>get_instance( ).
lo_config_facade->unassign_sys_alias_from_srv(
EXPORTING
iv_transport_cust = iv_transport_cust " Request/Task
iv_srg_identifier = mv_service_id " Service Document Identifier
iv_system_alias = iv_system_alias " SAP System Alias
iv_user_role = iv_user_role " Name of a User Role
).
CATCH cx_root INTO lx_previous.
get_root_cause_exception(
IMPORTING
ev_root_cause_textid = ls_root_cause_textid
CHANGING
cx_previous = lx_previous ).
RAISE EXCEPTION TYPE /iwfnd/cx_cof
EXPORTING
textid = ls_root_cause_textid.
ENDTRY.
ELSE.
CLEAR ls_root_cause_textid.
"System alias '&1' is not available
ls_root_cause_textid-msgid = '/IWFND/CM_MGW'.
ls_root_cause_textid-msgno = 13.
ls_root_cause_textid-attr1 = iv_system_alias.
RAISE EXCEPTION TYPE /iwfnd/cx_cof
EXPORTING
textid = ls_root_cause_textid.
ENDIF.
ENDMETHOD.
* <SIGNATURE>---------------------------------------------------------------------------------------+
* | Instance Public Method ZCL_GATEWAY_SERVICE->REMOVE_ALL_ALIASES
* +-------------------------------------------------------------------------------------------------+
* | [--->] IV_TRANSPORT_CUST TYPE TRKORR(optional)
* | [!CX!] /IWFND/CX_COF
* +--------------------------------------------------------------------------------------</SIGNATURE>
METHOD remove_all_aliases.
DATA: ls_root_cause_textid TYPE root_cause_textid,
lo_config_facade TYPE REF TO /iwfnd/cl_cof_facade,
lx_previous TYPE REF TO cx_root,
lt_system_aliases TYPE /iwfnd/cl_cof_facade=>ty_gt_system_aliases,
ls_system_aliases TYPE /iwfnd/cl_cof_facade=>ty_gs_system_alias.
IF mv_record_customizing = abap_true AND iv_transport_cust IS INITIAL.
CLEAR ls_root_cause_textid.
ls_root_cause_textid-attr1 = 'System aliases cannot be removed from ' && mv_service_id && ' because no customizing request has been provided'.
ls_root_cause_textid-msgid = '/IWFND/CM_COS'.
ls_root_cause_textid-msgno = 163.
RAISE EXCEPTION TYPE /iwfnd/cx_cof
EXPORTING
textid = ls_root_cause_textid.
ENDIF.
TRY.
lo_config_facade = /iwfnd/cl_cof_facade=>get_instance( ).
lt_system_aliases = lo_config_facade->get_sys_aliases_of_srv( iv_service_id = mv_service_id ).
CATCH cx_root INTO lx_previous.
get_root_cause_exception(
IMPORTING
ev_root_cause_textid = ls_root_cause_textid
CHANGING
cx_previous = lx_previous ).
RAISE EXCEPTION TYPE /iwfnd/cx_cof
EXPORTING
textid = ls_root_cause_textid.
ENDTRY.
LOOP AT lt_system_aliases INTO ls_system_aliases.
TRY.
me->remove_alias(
EXPORTING
iv_transport_cust = iv_transport_cust
iv_system_alias = ls_system_aliases-system_alias
iv_user_role = ls_system_aliases-user_role
).
CATCH cx_root INTO lx_previous.
get_root_cause_exception(
IMPORTING
ev_root_cause_textid = ls_root_cause_textid
CHANGING
cx_previous = lx_previous ).
RAISE EXCEPTION TYPE /iwfnd/cx_cof
EXPORTING
textid = ls_root_cause_textid.
ENDTRY.
ENDLOOP.
ENDMETHOD.
* <SIGNATURE>---------------------------------------------------------------------------------------+
* | Instance Private Method ZCL_GATEWAY_SERVICE->SET_PROCESS_MODE
* +-------------------------------------------------------------------------------------------------+
* | [--->] IV_PROCESS_MODE TYPE /IWFND/MED_PROCESS_MODE
* | [--->] IV_TRANSPORT_CUST TYPE TRKORR(optional)
* | [--->] IV_TRANSPORT_DEV TYPE TRKORR(optional)
* | [!CX!] /IWFND/CX_COF
* +--------------------------------------------------------------------------------------</SIGNATURE>
METHOD set_process_mode.
DATA: ls_root_cause_textid TYPE root_cause_textid,
lo_config_facade TYPE REF TO /iwfnd/cl_cof_facade,
lx_previous TYPE REF TO cx_root,
mo_rem_activator TYPE REF TO /iwfnd/cl_med_rem_activation,
lv_transport_dev TYPE trkorr.
IF ( mv_record_customizing = abap_true AND iv_transport_cust IS INITIAL ).
CLEAR ls_root_cause_textid.
ls_root_cause_textid-attr1 = mv_service_id && ': process mode cannot be changed because no customizing request has been provided'.
ls_root_cause_textid-msgid = '/IWFND/CM_COS'.
ls_root_cause_textid-msgno = 163.
RAISE EXCEPTION TYPE /iwfnd/cx_cof
EXPORTING
textid = ls_root_cause_textid.
ENDIF.
IF ( mv_record_workbench = abap_true AND iv_transport_dev IS INITIAL ) .
CLEAR ls_root_cause_textid.
ls_root_cause_textid-attr1 = mv_service_id && ': process mode cannot be changed because no workbench request has been provided'.
ls_root_cause_textid-msgid = '/IWFND/CM_COS'.
ls_root_cause_textid-msgno = 163.
RAISE EXCEPTION TYPE /iwfnd/cx_cof
EXPORTING
textid = ls_root_cause_textid.
ENDIF.
TRY.
mo_rem_activator = /iwfnd/cl_med_rem_activation=>get_remote_activator( ).
DATA : ls_service_group TYPE /iwfnd/cl_med_rem_exploration=>ty_s_service_group.
"Name of transport request has to be provided using a changing parameter.
"Since input parameters iv_* cannot be changed
"iv_transport_dev is moved to a local variable
lv_transport_dev = iv_transport_dev.
IF iv_process_mode <> /iwfnd/if_mgw_core_types=>gcs_process_mode-routing_based
AND iv_process_mode <> /iwfnd/if_mgw_core_types=>gcs_process_mode-co_deployed_only.
CLEAR ls_root_cause_textid.
ls_root_cause_textid-attr1 = 'iv_process_mode must be equal to "C" or " "'.
ls_root_cause_textid-msgid = '/IWFND/CM_COS'.
ls_root_cause_textid-msgno = 163.
RAISE EXCEPTION TYPE /iwfnd/cx_cof
EXPORTING
textid = ls_root_cause_textid.
ENDIF.
ls_service_group = me->get_service_group( ).
"set processing mode to either co-deployed or routing based
ls_service_group-process_mode = iv_process_mode.
"remove all aliases if running co-deployed
IF iv_process_mode = /iwfnd/if_mgw_core_types=>gcs_process_mode-co_deployed_only.
me->remove_all_aliases(
iv_transport_cust = iv_transport_cust
).
ENDIF.
mo_rem_activator->update_process_mode(
EXPORTING
is_service_group = ls_service_group " Service Group
iv_srv_identifier = mv_service_id " Service Document Identifier
CHANGING
cv_transport = lv_transport_dev " Request/Task
).
CATCH cx_root INTO lx_previous.
get_root_cause_exception(
IMPORTING
ev_root_cause_textid = ls_root_cause_textid
CHANGING
cx_previous = lx_previous ).
RAISE EXCEPTION TYPE /iwfnd/cx_cof
EXPORTING
textid = ls_root_cause_textid.
ENDTRY.
ENDMETHOD.
* <SIGNATURE>---------------------------------------------------------------------------------------+
* | Instance Public Method ZCL_GATEWAY_SERVICE->SET_TO_CODEPLOYED
* +-------------------------------------------------------------------------------------------------+
* | [--->] IV_TRANSPORT_CUST TYPE TRKORR(optional)
* | [--->] IV_TRANSPORT_DEV TYPE TRKORR(optional)
* | [!CX!] /IWFND/CX_COF
* +--------------------------------------------------------------------------------------</SIGNATURE>
METHOD set_to_codeployed.
DATA : ls_root_cause_textid TYPE root_cause_textid,
lx_previous TYPE REF TO cx_root.
TRY.
me->set_process_mode(
EXPORTING
iv_process_mode = /iwfnd/if_mgw_core_types=>gcs_process_mode-co_deployed_only
iv_transport_cust = iv_transport_cust
iv_transport_dev = iv_transport_dev
).
CATCH cx_root INTO lx_previous.
get_root_cause_exception(
IMPORTING
ev_root_cause_textid = ls_root_cause_textid
CHANGING
cx_previous = lx_previous ).
RAISE EXCEPTION TYPE /iwfnd/cx_cof
EXPORTING
textid = ls_root_cause_textid.
ENDTRY.
ENDMETHOD.
* <SIGNATURE>---------------------------------------------------------------------------------------+
* | Instance Public Method ZCL_GATEWAY_SERVICE->SET_TO_ROUTING_BASED
* +-------------------------------------------------------------------------------------------------+
* | [--->] IV_TRANSPORT_CUST TYPE TRKORR(optional)
* | [--->] IV_TRANSPORT_DEV TYPE TRKORR(optional)
* | [!CX!] /IWFND/CX_COF
* +--------------------------------------------------------------------------------------</SIGNATURE>
METHOD set_to_routing_based.
DATA : ls_root_cause_textid TYPE root_cause_textid,
lx_previous TYPE REF TO cx_root.
TRY.
me->set_process_mode(
EXPORTING
iv_process_mode = /iwfnd/if_mgw_core_types=>gcs_process_mode-routing_based
iv_transport_cust = iv_transport_cust
iv_transport_dev = iv_transport_dev
).
CATCH cx_root INTO lx_previous.
get_root_cause_exception(
IMPORTING
ev_root_cause_textid = ls_root_cause_textid
CHANGING
cx_previous = lx_previous ).
RAISE EXCEPTION TYPE /iwfnd/cx_cof
EXPORTING
textid = ls_root_cause_textid.
ENDTRY.
ENDMETHOD.
ENDCLASS.
CLASS zcl_stct_gw_srv_mass_maint DEFINITION
PUBLIC
INHERITING FROM cl_stctm_report_ui
FINAL
CREATE PUBLIC .
PUBLIC SECTION.
INTERFACES if_stctm_bg_task .
CLASS-DATA mv_initial TYPE abap_bool .
METHODS constructor .
METHODS if_stctm_task~get_description
REDEFINITION .
METHODS if_stctm_task~get_docu_object
REDEFINITION .
METHODS if_stctm_ui_task~maintained
REDEFINITION .
METHODS if_stctm_task~show_message_details
REDEFINITION.
PROTECTED SECTION.
PRIVATE SECTION.
TYPES: BEGIN OF ty_deleted_service,
technical_name TYPE /iwfnd/med_mdl_srg_name,
version TYPE /iwfnd/med_mdl_version,
END OF ty_deleted_service.
DATA: lt_deleted_gw_service_group TYPE STANDARD TABLE OF ty_deleted_service,
ls_deleted_gw_service_group TYPE ty_deleted_service.
ENDCLASS.
CLASS ZCL_STCT_GW_SRV_MASS_MAINT IMPLEMENTATION.
* <SIGNATURE>---------------------------------------------------------------------------------------+
* | Instance Public Method ZCL_STCT_GW_SRV_MASS_MAINT->CONSTRUCTOR
* +-------------------------------------------------------------------------------------------------+
* +--------------------------------------------------------------------------------------</SIGNATURE>
METHOD constructor.
super->constructor( 'ZR_STCT_UI_MAINT_GW_SERVICES' ).
if_stctm_task~p_phase = cl_stc_task_utilities=>c_phase-config.
if_stctm_task~p_component = 'GATEWAY'.
if_stctm_task~p_multiple_usage = abap_true.
" required predecessor
APPEND 'CL_STCT_CREATE_REQUEST_CUST' TO if_stctm_task~pt_predecessor.
APPEND 'CL_STCT_CREATE_REQUEST_WBENCH' TO if_stctm_task~pt_predecessor.
mv_initial = abap_true.
ENDMETHOD.
* <SIGNATURE>---------------------------------------------------------------------------------------+
* | Instance Public Method ZCL_STCT_GW_SRV_MASS_MAINT->IF_STCTM_BG_TASK~CHECKMODE
* +-------------------------------------------------------------------------------------------------+
* | [--->] IR_TASKLIST TYPE REF TO CL_STCTM_TASKLIST
* | [<-()] R_CHECKMODE TYPE IF_STCTM_TASK=>T_BOOL
* +--------------------------------------------------------------------------------------</SIGNATURE>
METHOD if_stctm_bg_task~checkmode.
ENDMETHOD.
* <SIGNATURE>---------------------------------------------------------------------------------------+
* | Instance Public Method ZCL_STCT_GW_SRV_MASS_MAINT->IF_STCTM_BG_TASK~EXECUTE
* +-------------------------------------------------------------------------------------------------+
* | [--->] IR_TASKLIST TYPE REF TO CL_STCTM_TASKLIST
* | [--->] I_TRACE TYPE STC_TRACE(optional)
* | [--->] I_CHECK TYPE STC_CHECKRUN(optional)
* | [EXC!] ERROR_OCCURED
* | [EXC!] WARNING_OCCURED
* +--------------------------------------------------------------------------------------</SIGNATURE>
METHOD if_stctm_bg_task~execute.
DATA: ls_variant TYPE t_variant,
ls_variant_detail TYPE t_variant.
DATA: it_e071 TYPE tr_objects ##NEEDED,
it_e071k TYPE tr_keys,
wa_e071 TYPE ko200,
wa_e071k TYPE e071k.
DATA: "parameter needed to deactivate a service
lv_deact TYPE c LENGTH 1,
"parameters needed to add an alias
lv_add TYPE c LENGTH 1,
lv_aliasa TYPE /iwfnd/c_dfsyal-system_alias, " /iwfnd/defi_system_alias
lv_role TYPE /iwfnd/defi_role_name,
lv_isdef TYPE c LENGTH 1,
lv_isdefm TYPE c LENGTH 1,
"parameters needed to remove an alias
lv_remove TYPE c LENGTH 1,
lv_aliasr TYPE /iwfnd/c_dfsyal-system_alias, " /iwfnd/defi_system_alias
"parameters needed to add aliases from a template service
lv_gettmp TYPE c LENGTH 1,
lv_tmp_id TYPE /iwfnd/i_med_srh-srv_identifier, "service that shall be used as a template
"parameters needed for co-deployment, routing based setup and to remove all aliases
lv_setco TYPE c LENGTH 1,
lv_setrou TYPE c LENGTH 1,
lv_remall TYPE c LENGTH 1,
"selected services
ls_i_med_srh TYPE /iwfnd/i_med_srh,
lrt_srv_id LIKE RANGE OF ls_i_med_srh-srv_identifier,
lrs_srv_id LIKE LINE OF lrt_srv_id.
DATA ls_task TYPE cl_stctm_tasklist=>ts_task.
"customizing request
DATA ls_task_creq TYPE cl_stctm_tasklist=>ts_task.
DATA lo_task_creq TYPE REF TO cl_stct_create_request_cust.
DATA lx_cast_exc_creq TYPE REF TO cx_sy_move_cast_error ##NEEDED.
DATA lv_request_cust TYPE char20.
DATA lv_client_changes_allowed TYPE abap_bool.
"workbench request
DATA ls_task_wreq TYPE cl_stctm_tasklist=>ts_task.
DATA lo_task_wreq TYPE REF TO cl_stct_create_request_wbench.
DATA lx_cast_exc_wreq TYPE REF TO cx_sy_move_cast_error ##NEEDED.
DATA lv_request_work TYPE char20.
"maintain gw service
DATA lv_message TYPE string.
DATA lv_bapi_msg_text(220) TYPE c.
DATA lo_gw_service TYPE REF TO zcl_gateway_service.
DATA lv_error_occured TYPE abap_bool.
DATA : lv_deleted_gw_service_group TYPE /iwfnd/cl_med_rem_exploration=>ty_s_service_group.
*----------------------------------------------------------------
* GET UI PARAMETER
*----------------------------------------------------------------
LOOP AT pt_variant INTO ls_variant.
CASE ls_variant-selname.
WHEN 'P_DEACT'.
lv_deact = ls_variant-low.
WHEN 'P_ADD'.
lv_add = ls_variant-low.
READ TABLE pt_variant INTO ls_variant_detail WITH KEY selname = 'P_ALIASA'.
IF ls_variant_detail-low IS NOT INITIAL. "alias to be added has been selected
lv_aliasa = ls_variant_detail-low.
ENDIF.
READ TABLE pt_variant INTO ls_variant_detail WITH KEY selname = 'P_ROLE'.
IF ls_variant_detail-low IS NOT INITIAL. "alias to be added has been selected
lv_role = ls_variant_detail-low.
ENDIF.
READ TABLE pt_variant INTO ls_variant_detail WITH KEY selname = 'P_ISDEF'.
IF ls_variant_detail-low IS NOT INITIAL. "alias to be added has been selected
lv_isdef = ls_variant_detail-low.
ENDIF.
READ TABLE pt_variant INTO ls_variant_detail WITH KEY selname = 'P_ISDEFM'.
IF ls_variant_detail-low IS NOT INITIAL. "alias to be added has been selected
lv_isdefm = ls_variant_detail-low.
ENDIF.
WHEN 'P_REMOVE'.
lv_remove = ls_variant-low.
READ TABLE pt_variant INTO ls_variant_detail WITH KEY selname = 'P_ALIASR'.
IF ls_variant_detail-low IS NOT INITIAL. "alias to be removed has been selected
lv_aliasr = ls_variant_detail-low.
ENDIF.
WHEN 'P_GETTMP'.
lv_gettmp = ls_variant-low.
READ TABLE pt_variant INTO ls_variant_detail WITH KEY selname = 'P_TMP_ID'.
IF ls_variant_detail-low IS NOT INITIAL. "service that shall be used as a template
lv_tmp_id = ls_variant_detail-low.
ENDIF.
WHEN 'P_SETCO'.
lv_setco = ls_variant-low.
WHEN 'P_SETROU'.
lv_setrou = ls_variant-low.
WHEN 'S_SRV_ID'.
lrs_srv_id-low = ls_variant-low.
lrs_srv_id-high = ls_variant-high.
lrs_srv_id-option = ls_variant-option.
lrs_srv_id-sign = ls_variant-sign.
APPEND lrs_srv_id TO lrt_srv_id.
WHEN 'P_REMALL'.
lv_remall = ls_variant-low.
ENDCASE.
ENDLOOP.
*----------------------------------------------------------------
* GET REQUEST CUST
*----------------------------------------------------------------
" get stored data from prerequiste task 'CREATE CUSTOMIZING REQUEST'
READ TABLE ir_tasklist->ptx_task INTO ls_task_creq WITH KEY taskname = 'CL_STCT_CREATE_REQUEST_CUST'.
IF sy-subrc = 0.
TRY.
lo_task_creq ?= ls_task_creq-r_task.
lv_request_cust = lo_task_creq->p_request_customizing.
lv_client_changes_allowed = lo_task_creq->p_client_changes_allowed.
CATCH cx_sy_move_cast_error INTO lx_cast_exc_creq.
MESSAGE e000(s_lmcfg_core_tasks) WITH 'Could not get Request from Task CREATE CUSTOMIZING REQUEST' INTO if_stctm_task~pr_log->dummy ##MG_ARG_LEN ##NO_TEXT.
if_stctm_task~pr_log->add_syst( ).
RAISE error_occured.
ENDTRY.
ENDIF.
*----------------------------------------------------------------
* GET REQUEST WORK
*----------------------------------------------------------------
" get stored data from prerequiste task 'CREATE CUSTOMIZING REQUEST'
READ TABLE ir_tasklist->ptx_task INTO ls_task_wreq WITH KEY taskname = 'CL_STCT_CREATE_REQUEST_WBENCH'.
IF sy-subrc = 0.
TRY.
lo_task_wreq ?= ls_task_wreq-r_task.
lv_request_work = lo_task_wreq->p_request_workbench.
CATCH cx_sy_move_cast_error INTO lx_cast_exc_wreq.
MESSAGE e000(s_lmcfg_core_tasks) WITH 'Could not get Request from Task CREATE WORKING REQUEST' INTO if_stctm_task~pr_log->dummy ##MG_ARG_LEN ##NO_TEXT.
if_stctm_task~pr_log->add_syst( ).
RAISE error_occured.
ENDTRY.
ENDIF.
IF i_check EQ 'X' . "check mode
" check if required predecessor task "Create/Select Customizing Request (SE09)" is in tasklist
READ TABLE ir_tasklist->ptx_task INTO ls_task WITH KEY taskname = 'CL_STCT_CREATE_REQUEST_CUST'.
IF sy-subrc NE 0.
MESSAGE e124(s_lmcfg_core_tasks) WITH 'Create Customizing Request (SE09)' INTO if_stctm_task~pr_log->dummy ##NO_TEXT.
if_stctm_task~pr_log->add_syst( ).
RAISE error_occured.
ENDIF.
" check if required predecessor task "Create/Select Customizing Request (SE09)" is in tasklist
READ TABLE ir_tasklist->ptx_task INTO ls_task WITH KEY taskname = 'CL_STCT_CREATE_REQUEST_WBENCH'.
IF sy-subrc NE 0.
MESSAGE e124(s_lmcfg_core_tasks) WITH 'Create Working Request (SE09)' INTO if_stctm_task~pr_log->dummy ##NO_TEXT.
if_stctm_task~pr_log->add_syst( ).
RAISE error_occured.
ENDIF.
*----------------------------------------------------------------
* excecution mode
*----------------------------------------------------------------
ELSE. " execution mode
lv_error_occured = abap_false.
SELECT * FROM /iwfnd/i_med_srh INTO TABLE @DATA(lt_i_med_srh)
WHERE srv_identifier IN @lrt_srv_id.
LOOP AT lt_i_med_srh INTO ls_i_med_srh.
DATA(p_srv_id) = ls_i_med_srh-srv_identifier.
TRY.
lo_gw_service = NEW zcl_gateway_service( iv_service_id = p_srv_id ).
CATCH /iwfnd/cx_cof INTO DATA(ocx_my).
lv_message = ocx_my->get_text( ).
MESSAGE w101(s_lmcfg_core_tasks) WITH lv_message INTO if_stctm_task~pr_log->dummy ##NO_TEXT.
if_stctm_task~pr_log->add_syst( ).
lv_error_occured = abap_true.
EXIT.
ENDTRY.
IF lv_deact = abap_true.
TRY.
lv_deleted_gw_service_group = lo_gw_service->get_service_group( ).
lo_gw_service->delete(
EXPORTING
iv_transport_cust = lv_request_cust
iv_transport_dev = lv_request_work
).
CONCATENATE lv_deleted_gw_service_group-technical_name lv_deleted_gw_service_group-version ' deleted successfully.' INTO lv_bapi_msg_text SEPARATED BY space .
"lv_bapi_msg_text = lv_deleted_gw_service_group-technical_name && lv_deleted_gw_service_group-version && ' deleted successfully.'.
"MESSAGE i101(s_lmcfg_core_tasks) WITH lv_bapi_msg_text INTO if_stctm_task~pr_log->dummy ##NO_TEXT.
if_stctm_task~pr_log->add_text( EXPORTING i_text = lv_bapi_msg_text ).
ls_deleted_gw_service_group-technical_name = lv_deleted_gw_service_group-technical_name.
ls_deleted_gw_service_group-version = lv_deleted_gw_service_group-version.
APPEND ls_deleted_gw_service_group TO lt_deleted_gw_service_group.
CATCH /iwfnd/cx_cof INTO ocx_my.
lv_message = ocx_my->get_text( ).
DATA: lt_string_comp TYPE STANDARD TABLE OF swastrtab,
ls_string_comp TYPE swastrtab.
CALL FUNCTION 'SWA_STRING_SPLIT'
EXPORTING
input_string = lv_message "string to be split
max_component_length = 50
" TERMINATING_SEPARATORS =
" OPENING_SEPARATORS =
TABLES
string_components = lt_string_comp
" EXCEPTIONS
" MAX_COMPONENT_LENGTH_INVALID = 1
" OTHERS = 2
.
IF sy-subrc <> 0.
" Implement suitable error handling here
" try to pass the original string
MESSAGE w101(s_lmcfg_core_tasks) WITH lv_message INTO if_stctm_task~pr_log->dummy ##NO_TEXT.
ELSE.
"itab lt_string_comp contains strings with a length of max. 50 characters
IF strlen( lv_message ) <= 50.
MESSAGE w101(s_lmcfg_core_tasks) WITH lt_string_comp[ 1 ]-str INTO if_stctm_task~pr_log->dummy ##NO_TEXT.
ELSEIF strlen( lv_message ) <= 100.
MESSAGE w101(s_lmcfg_core_tasks) WITH lt_string_comp[ 1 ]-str lt_string_comp[ 2 ]-str INTO if_stctm_task~pr_log->dummy ##NO_TEXT.
ELSEIF strlen( lv_message ) <= 150.
MESSAGE w101(s_lmcfg_core_tasks) WITH lt_string_comp[ 1 ]-str lt_string_comp[ 2 ]-str lt_string_comp[ 3 ]-str INTO if_stctm_task~pr_log->dummy ##NO_TEXT.
ELSE. "max length of a parameter is 50 characters and we can have at max. 4 parameters => not more than 200 characters can be passed
MESSAGE w101(s_lmcfg_core_tasks) WITH lt_string_comp[ 1 ]-str lt_string_comp[ 2 ]-str lt_string_comp[ 3 ]-str lt_string_comp[ 4 ]-str INTO if_stctm_task~pr_log->dummy ##NO_TEXT.
ENDIF.
ENDIF.
if_stctm_task~pr_log->add_syst( ).
lv_error_occured = abap_true.
ENDTRY.
ELSEIF lv_add = abap_true.
TRY.
lo_gw_service->add_alias(
EXPORTING
iv_transport_cust = lv_request_cust
iv_system_alias = lv_aliasa
iv_user_role = lv_role
iv_is_default = lv_isdef
iv_is_def_for_meta = lv_isdefm
).
CONCATENATE p_srv_id 'Alias ' lv_aliasa ' added.' INTO lv_bapi_msg_text SEPARATED BY space.
if_stctm_task~pr_log->add_text( EXPORTING i_text = lv_bapi_msg_text ).
CATCH /iwfnd/cx_cof INTO ocx_my.
lv_message = ocx_my->get_text( ).
MESSAGE w101(s_lmcfg_core_tasks) WITH lv_message INTO if_stctm_task~pr_log->dummy ##NO_TEXT.
if_stctm_task~pr_log->add_syst( ).
lv_error_occured = abap_true.
ENDTRY.
ELSEIF lv_remove = abap_true.
TRY.
lo_gw_service->remove_alias(
EXPORTING
iv_transport_cust = lv_request_cust
iv_system_alias = lv_aliasr
iv_user_role = lv_role
).
CONCATENATE p_srv_id 'Alias ' lv_aliasr ' removed.' INTO lv_bapi_msg_text SEPARATED BY space.
if_stctm_task~pr_log->add_text( EXPORTING i_text = lv_bapi_msg_text ).
CATCH /iwfnd/cx_cof INTO ocx_my.
lv_message = ocx_my->get_text( ).
MESSAGE w101(s_lmcfg_core_tasks) WITH lv_message INTO if_stctm_task~pr_log->dummy ##NO_TEXT.
if_stctm_task~pr_log->add_syst( ).
lv_error_occured = abap_true.
ENDTRY.
ELSEIF lv_gettmp = abap_true.
TRY.
lo_gw_service->assign_aliases_from_service(
EXPORTING
iv_template_service_id = lv_tmp_id
iv_transport_cust = lv_request_cust
).
CONCATENATE p_srv_id 'Aliases from ' lv_tmp_id ' assigned.' INTO lv_bapi_msg_text SEPARATED BY space.
if_stctm_task~pr_log->add_text( EXPORTING i_text = lv_bapi_msg_text ).
CATCH /iwfnd/cx_cof INTO ocx_my.
lv_message = ocx_my->get_text( ).
MESSAGE w101(s_lmcfg_core_tasks) WITH lv_message INTO if_stctm_task~pr_log->dummy ##NO_TEXT.
if_stctm_task~pr_log->add_syst( ).
lv_error_occured = abap_true.
ENDTRY.
ELSEIF lv_setco = abap_true.
TRY.
lo_gw_service->set_to_codeployed(
iv_transport_cust = lv_request_cust
iv_transport_dev = lv_request_work
).
CONCATENATE p_srv_id ' set to co-deployed.' INTO lv_bapi_msg_text SEPARATED BY space.
if_stctm_task~pr_log->add_text( EXPORTING i_text = lv_bapi_msg_text ).
CATCH /iwfnd/cx_cof INTO ocx_my.
lv_message = ocx_my->get_text( ).
MESSAGE w101(s_lmcfg_core_tasks) WITH lv_message INTO if_stctm_task~pr_log->dummy ##NO_TEXT.
if_stctm_task~pr_log->add_syst( ).
lv_error_occured = abap_true.
ENDTRY.
ELSEIF lv_setrou = abap_true.
TRY.
lo_gw_service->set_to_routing_based(
iv_transport_cust = lv_request_cust
iv_transport_dev = lv_request_work
).
CONCATENATE p_srv_id ' set to routing based.' INTO lv_bapi_msg_text SEPARATED BY space.
if_stctm_task~pr_log->add_text( EXPORTING i_text = lv_bapi_msg_text ).
CATCH /iwfnd/cx_cof INTO ocx_my.
lv_message = ocx_my->get_text( ).
MESSAGE w101(s_lmcfg_core_tasks) WITH lv_message INTO if_stctm_task~pr_log->dummy ##NO_TEXT.
if_stctm_task~pr_log->add_syst( ).
lv_error_occured = abap_true.
ENDTRY.
ELSEIF lv_remall = abap_true.
TRY.
lo_gw_service->remove_all_aliases(
iv_transport_cust = lv_request_cust
).
CONCATENATE p_srv_id ' :all aliases have been removed.' INTO lv_bapi_msg_text SEPARATED BY space.
if_stctm_task~pr_log->add_text( EXPORTING i_text = lv_bapi_msg_text ).
CATCH /iwfnd/cx_cof INTO ocx_my.
lv_message = ocx_my->get_text( ).
MESSAGE w101(s_lmcfg_core_tasks) WITH lv_message INTO if_stctm_task~pr_log->dummy ##NO_TEXT.
if_stctm_task~pr_log->add_syst( ).
lv_error_occured = abap_true.
ENDTRY.
ELSE.
lv_bapi_msg_text = 'nothing selected'.
if_stctm_task~pr_log->add_text( EXPORTING i_text = lv_bapi_msg_text ).
ENDIF.
ENDLOOP.
DATA lv_number_of_deleted_services TYPE string.
IF lv_deact = abap_true.
DESCRIBE TABLE lt_deleted_gw_service_group LINES lv_number_of_deleted_services.
CONCATENATE lv_number_of_deleted_services 'services deleted. For the list of deleted services click here'
INTO lv_bapi_msg_text SEPARATED BY space.
if_stctm_task~pr_log->add_text(
EXPORTING
i_type = 'I' " Message type
i_text = lv_bapi_msg_text " Message text
i_details = 'X'
).
ENDIF.
"an error occured when maintaining one of the selected services
"raising the error only after all services have been maintained.
IF lv_error_occured = abap_true.
if_stctm_task~pr_log->add_text(
EXPORTING
i_type = 'E' " Message type
i_text = 'One or more maintenace operations failed.' " Message text
).
RAISE error_occured.
ENDIF.
ENDIF.
ENDMETHOD.
* <SIGNATURE>---------------------------------------------------------------------------------------+
* | Instance Public Method ZCL_STCT_GW_SRV_MASS_MAINT->IF_STCTM_BG_TASK~LONGRUNNER
* +-------------------------------------------------------------------------------------------------+
* | [--->] IR_TASKLIST TYPE REF TO CL_STCTM_TASKLIST
* | [<-()] R_LONGRUNNER TYPE IF_STCTM_TASK=>T_BOOL
* +--------------------------------------------------------------------------------------</SIGNATURE>
METHOD if_stctm_bg_task~longrunner.
r_longrunner = if_stctm_task=>c_bool-false.
ENDMETHOD.
* <SIGNATURE>---------------------------------------------------------------------------------------+
* | Instance Public Method ZCL_STCT_GW_SRV_MASS_MAINT->IF_STCTM_BG_TASK~RESUMABLE
* +-------------------------------------------------------------------------------------------------+
* | [--->] IR_TASKLIST TYPE REF TO CL_STCTM_TASKLIST
* | [<-()] R_RESUMABLE TYPE IF_STCTM_TASK=>T_BOOL
* +--------------------------------------------------------------------------------------</SIGNATURE>
METHOD if_stctm_bg_task~resumable.
r_resumable = if_stctm_task=>c_bool-true.
ENDMETHOD.
* <SIGNATURE>---------------------------------------------------------------------------------------+
* | Instance Public Method ZCL_STCT_GW_SRV_MASS_MAINT->IF_STCTM_TASK~GET_DESCRIPTION
* +-------------------------------------------------------------------------------------------------+
* | [<-()] RV_DESCR TYPE STC_TASK_DESCR
* +--------------------------------------------------------------------------------------</SIGNATURE>
METHOD if_stctm_task~get_description.
rv_descr = 'Mass maintenance for OData V2 services'.
ENDMETHOD.
* <SIGNATURE>---------------------------------------------------------------------------------------+
* | Instance Public Method ZCL_STCT_GW_SRV_MASS_MAINT->IF_STCTM_TASK~GET_DOCU_OBJECT
* +-------------------------------------------------------------------------------------------------+
* | [<---] EV_DOKU_ID TYPE DOKU_ID
* | [<---] EV_DOKU_OBJ TYPE DOKU_OBJ
* | [<---] EV_VAR1 TYPE SYMSGV
* | [<---] EV_VAR2 TYPE SYMSGV
* | [<---] EV_VAR3 TYPE SYMSGV
* | [<---] EV_VAR4 TYPE SYMSGV
* +--------------------------------------------------------------------------------------</SIGNATURE>
METHOD if_stctm_task~get_docu_object.
ev_doku_id = 'TX'.
ev_doku_obj = 'Z_STCT_GW_SRV_MASS_MAINT'.
ENDMETHOD.
* <SIGNATURE>---------------------------------------------------------------------------------------+
* | Instance Public Method ZCL_STCT_GW_SRV_MASS_MAINT->IF_STCTM_TASK~SHOW_MESSAGE_DETAILS
* +-------------------------------------------------------------------------------------------------+
* | [--->] I_DETAILS TYPE STRING
* | [EXC!] ERROR_OCCURED
* +--------------------------------------------------------------------------------------</SIGNATURE>
METHOD if_stctm_task~show_message_details.
CALL METHOD cl_demo_output=>display_data
EXPORTING
value = lt_deleted_gw_service_group
* name = " Name
.
ENDMETHOD.
* <SIGNATURE>---------------------------------------------------------------------------------------+
* | Instance Public Method ZCL_STCT_GW_SRV_MASS_MAINT->IF_STCTM_UI_TASK~MAINTAINED
* +-------------------------------------------------------------------------------------------------+
* | [--->] IR_TASKLIST TYPE REF TO CL_STCTM_TASKLIST(optional)
* | [--->] IR_MESSAGES TYPE REF TO IF_STCTM_TASK_MESSAGES(optional)
* | [<-()] R_MAINTAINED TYPE IF_STCTM_TASK=>T_BOOL
* +--------------------------------------------------------------------------------------</SIGNATURE>
METHOD if_stctm_ui_task~maintained.
DATA ls_variant TYPE LINE OF tt_variant.
DATA: sep(1) TYPE c VALUE ' ',
txt1(256) TYPE c,
outputtxt(256) TYPE c.
DATA: task_selected TYPE stc_task_status.
* call ui maintain method
r_maintained = super->if_stctm_ui_task~maintained( ir_tasklist ).
* check if task is selected (01 - selected / 02 - not selected)
task_selected = if_stctm_task~p_status.
* display parameter description
IF task_selected = '02' OR r_maintained <> 'X'.
" clear param description
if_stctm_ui_task~p_variant_descr = ''.
ELSE.
" check if services have been selected
READ TABLE pt_variant INTO ls_variant WITH KEY selname = 'S_SRV_ID'.
IF ls_variant-low IS NOT INITIAL. "services have been selected
txt1 = 'OK' .
READ TABLE pt_variant INTO ls_variant WITH KEY selname = 'P_ADD'.
IF ls_variant-low IS NOT INITIAL. "check if a system alias have been entered
READ TABLE pt_variant INTO ls_variant WITH KEY selname = 'P_ALIASA'.
IF ls_variant-low IS INITIAL. "No alias to be added has been selected
r_maintained =''.
txt1 = 'No alias to be added has been selected'.
ENDIF.
ENDIF.
READ TABLE pt_variant INTO ls_variant WITH KEY selname = 'P_REMOVE'.
IF ls_variant-low IS NOT INITIAL. "check if a system alias have been entered
READ TABLE pt_variant INTO ls_variant WITH KEY selname = 'P_ALIASR'.
IF ls_variant-low IS INITIAL. "No alias to be removed has been selected
r_maintained =''.
txt1 = 'No alias to be removed has been selected'.
ENDIF.
ENDIF.
READ TABLE pt_variant INTO ls_variant WITH KEY selname = 'P_GETTMP'.
IF ls_variant-low IS NOT INITIAL. "check if a service as a template for service assingments has been entered
READ TABLE pt_variant INTO ls_variant WITH KEY selname = 'P_TMP_ID'.
IF ls_variant-low IS INITIAL. "No service has been selected as a template
r_maintained =''.
txt1 = 'No service has been selected as a template'.
ENDIF.
ENDIF.
ELSE.
r_maintained =''.
txt1 = 'No services selected'.
ENDIF.
CONCATENATE 'Parameter check:' txt1 INTO outputtxt SEPARATED BY sep.
"output in parameter description
if_stctm_ui_task~p_variant_descr = outputtxt.
ENDIF.
ENDMETHOD.
ENDCLASS.
*&---------------------------------------------------------------------*
*& Report zr_stct_ui_maint_gw_services
*&---------------------------------------------------------------------*
*&
*&---------------------------------------------------------------------*
REPORT zr_stct_ui_maint_gw_services.
DATA: lv_service_name_bep TYPE /iwfnd/med_mdl_srg_name,
lv_service_version_bep TYPE /iwfnd/med_mdl_version,
ls_i_med_srh TYPE /iwfnd/i_med_srh.
SELECTION-SCREEN BEGIN OF BLOCK part0 WITH FRAME .
SELECT-OPTIONS s_srv_id FOR ls_i_med_srh-srv_identifier.
SELECTION-SCREEN END OF BLOCK part0 .
SELECTION-SCREEN BEGIN OF BLOCK part2 WITH FRAME .
PARAMETERS: p_add RADIOBUTTON GROUP opt . "add specified alias to the selected services
"details of the system alias that shall be assigned to the selected services
SELECTION-SCREEN BEGIN OF BLOCK part2a WITH FRAME.
"alias that shall be added
PARAMETERS : p_aliasa TYPE /iwfnd/c_dfsyal-system_alias, " /iwfnd/defi_system_alias,
p_role TYPE /iwfnd/defi_role_name,
p_isdef AS CHECKBOX,
p_isdefm AS CHECKBOX.
SELECTION-SCREEN END OF BLOCK part2a .
SELECTION-SCREEN ULINE.
PARAMETERS: p_gettmp RADIOBUTTON GROUP opt . "replace aliases of selected services by the aliases that are assigned to the template service
"service that shall be used from system alias assignment
SELECTION-SCREEN BEGIN OF BLOCK part2b WITH FRAME .
PARAMETERS: p_tmp_id TYPE /iwfnd/i_med_srh-srv_identifier. "service that shall be used as a template
SELECTION-SCREEN END OF BLOCK part2b.
SELECTION-SCREEN ULINE.
PARAMETERS : p_remove RADIOBUTTON GROUP opt . "remove specified alias from the selected services
SELECTION-SCREEN BEGIN OF BLOCK part2c WITH FRAME.
"alias that shall be removed
PARAMETERS : p_aliasr TYPE /iwfnd/c_dfsyal-system_alias.
SELECTION-SCREEN END OF BLOCK part2c .
SELECTION-SCREEN ULINE.
PARAMETERS: p_remall RADIOBUTTON GROUP opt . "remove all aliases from selected services
SELECTION-SCREEN ULINE.
PARAMETERS : p_setco RADIOBUTTON GROUP opt. "set to co-deployed
SELECTION-SCREEN ULINE.
PARAMETERS: p_setrou RADIOBUTTON GROUP opt. "set to routing based
TYPE-POOLS sctsc .
SELECTION-SCREEN ULINE.
PARAMETERS: p_deact RADIOBUTTON GROUP opt . "delete selected services
SELECTION-SCREEN END OF BLOCK part2 .
**********************************************************************
INITIALIZATION.
*----------------------------------------------------
* NO EXECUTION ---> Execution done with Task Manager
*----------------------------------------------------
START-OF-SELECTION.
WRITE: / 'NOTE: Execution is done with Task Manager (transaction STC01)'.
P_ADD Add single alias
P_ALIASA SAP system alias
P_ALIASR SAP system alias
P_DEACT Delete services
P_GETTMP Assign aliases from a template
P_ISDEF Set is default
P_ISDEFM Set is default for metadata
P_REMALL Remove all aliases
P_REMOVE Remove single alias
P_ROLE User role
P_SETCO Set to co-deployed
P_SETROU Set to routing based
P_TMP_ID Service used as a template
S_SRV_ID Services
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
10 | |
10 | |
10 | |
9 | |
8 | |
7 | |
6 | |
5 | |
5 | |
4 |