Вы находитесь на странице: 1из 5

CRM - Mass copy of UI config from one role to another

Applies to:

SAP CRM 6.0/7.0.

Summary

Mass copying of UI screen configurations from one role config key to another.

Author(s):

Arun Prakash Karuppanan Company: Accenture

Created on:

Author(s) Bio Arun Prakash karuppanan is a software engineer employed with Accenture, working on CRM implementations.

Apr 19 2010

Table of Contents

Applies to:on CRM implementations. Apr 19 2010 Table of Contents Summary Author(s): Intro Code Intro Sometimes, we

Summaryimplementations. Apr 19 2010 Table of Contents Applies to: Author(s): Intro Code Intro Sometimes, we may

Author(s):Apr 19 2010 Table of Contents Applies to: Summary Intro Code Intro Sometimes, we may have

Intro

Code

Intro

Sometimes, we may have a business role that is very similar to another. You will need to reconfigure a few screens using the UI tool and for the rest, the same config as the source role should be used. You can do two things. You can redefine the DO_CONFIG_DETERMINATION to specify the same config to be used for both roles and create a separate config, where needed. Or, you can copy all the screen configs and change where needed. When the number of component/views is large, either way is time consuming and not exactly an exciting work. Given below is a report program which mass copy all the configs from one role key to another and save them in a transport request. It is enough if you mention the Transport Request once. Then, you can start editing the required configs. Ofcourse, you can modify it to make it more specific, say at component level.

Code

REPORT zcopy_role_personalization.

START-OF-SELECTION.

PARAMETERS: p_frole TYPE bsp_dlc_role_key OBLIGATORY,

p_torole

TYPE bsp_dlc_role_key OBLIGATORY.

* p_comp TYPE bsp_wd_component_name,

* p_view

* p_cmpusg TYPE bsp_dlc_component_usage,

* p_objtyp TYPE bsp_dlc_object_type,

* p_objsty TYPE bsp_dlc_object_sub_type.

TYPE o2page,

TRANSLATE p_frole

TO UPPER CASE.

"#EC SYNTCHAR

* TRANSLATE p_comp

TO UPPER CASE.

"#EC SYNTCHAR

* TRANSLATE p_view

TO UPPER CASE.

"#EC SYNTCHAR

* TRANSLATE p_objtyp

TO UPPER CASE.

"#EC SYNTCHAR

* TRANSLATE p_objsty TO UPPER CASE.

"#EC SYNTCHAR

TRANSLATE p_torole

TO UPPER CASE.

"#EC SYNTCHAR

*

IF p_cmpusg IS INITIAL.

*

p_cmpusg = <DEFAULT>.

*

ENDIF.

*

*

IF p_objtyp IS INITIAL.

*

p_objtyp = <DEFAULT>.

*

ENDIF.

*

*

IF p_objsty IS INITIAL.

*

p_objsty = <DEFAULT>.

*

ENDIF.

DATA: lv_transport_data TYPE string,

 

lv_exist

TYPE boole_d,

ls_transport_data TYPE bsp_dlc_config_transport_data,

lv_display_mode

TYPE boolean,

lt_bsp_dl_xmlstrx2 TYPE STANDARD TABLE OF bsp_dl_xmlstrx2, ls_bsp_dl_xmlstrx2 LIKE LINE OF lt_bsp_dl_xmlstrx2,

lt_bspc_dl_xmlstrx2 TYPE STANDARD TABLE OF bspc_dl_xmlstrx2, ls_bspc_dl_xmlstrx2 LIKE LINE OF lt_bspc_dl_xmlstrx2,

ls_config_key

TYPE bsp_dcls_conf_semantic_key,

ls_check_msg

TYPE bapiret2,

lt_check_msg

TYPE bapiret2_t,

lv_check_failed

TYPE boolean.

IF cl_bsp_dlc_config_util=>is_sap_system( ) = abap_true.

*

SAP development system SELECT * FROM bsp_dl_xmlstrx2 INTO TABLE lt_bsp_dl_xmlstrx2 "#EC CI_SGLSELECT WHERE

role_key

= p_frole

.

IF sy-subrc = 0. *Follow same steps done for Customer system

ENDIF.

ELSE.

* Customer system SELECT * FROM bspc_dl_xmlstrx2 INTO TABLE lt_bspc_dl_xmlstrx2 "#EC CI_SGLSELECT WHERE

role_key

= p_frole

.

IF sy-subrc = 0. LOOP AT lt_bspc_dl_xmlstrx2 INTO ls_bspc_dl_xmlstrx2.

CLEAR: ls_config_key, lv_exist, lv_check_failed.

REFRESH: lt_check_msg.

ls_config_key-component = ls_bspc_dl_xmlstrx2-component. ls_config_key-viewname = ls_bspc_dl_xmlstrx2-viewname. ls_config_key-role_key = p_torole. ls_config_key-component_usage = ls_bspc_dl_xmlstrx2-component_usage. ls_config_key-object_type = ls_bspc_dl_xmlstrx2-object_type. ls_config_key-object_sub_type = ls_bspc_dl_xmlstrx2-object_sub_type.

AUTHORITY-CHECK OBJECT 'CRM_CONFIG'

ID 'ACTVT' FIELD '02' ID 'UI_COMP' FIELD ls_config_key-component ID 'VIEWNAME' FIELD ls_config_key-viewname ID 'ROLE_KEY' FIELD ls_config_key-role_key ID 'OBJECT_TYP' FIELD ls_config_key-object_type. IF sy-subrc NE 0. MESSAGE ID 'BSP_WD_TOOLS' TYPE 'S' NUMBER '305' DISPLAY LIKE 'E'. CONTINUE.

"#EC *

ELSE.

CALL METHOD cl_bsp_dlc_config_util=>check_config_key_input EXPORTING iv_component = ls_config_key-component iv_viewname = ls_config_key-viewname

is_sem_key

IMPORTING

et_msg

ev_failed

= ls_config_key

= lt_check_msg = lv_check_failed.

IF lv_check_failed = abap_true. LOOP AT lt_check_msg INTO ls_check_msg. MESSAGE ID ls_check_msg-id TYPE 'S' NUMBER ls_check_msg-number DISPLAY LIKE ls_check_msg-type WITH ls_check_msg-message_v1 ls_check_msg-message_v2.

ENDLOOP.

CONTINUE.

ENDIF.

* check for existing configuration CALL METHOD cl_bsp_dlc_xml_storage2=>check_existence EXPORTING

iv_component

= ls_config_key-component

iv_viewname

= ls_config_key-viewname

iv_role_key

= ls_config_key-role_key

iv_component_usage = ls_config_key-component_usage

iv_object_type

iv_object_sub_type = ls_config_key-object_sub_type

iv_origin

= ls_config_key-object_type

= space

RECEIVING

rv_result

= lv_exist.

IF lv_exist = abap_true. MESSAGE ID 'BSP_WD_TOOLS' TYPE 'S' NUMBER '300' DISPLAY LIKE 'E'. CONTINUE.

ENDIF.

* copy config DATA: lv_applname lv_disp_mode lv_dummy_string

TYPE o2applname, TYPE flag, TYPE string.

*Put everything in the same TR IF ls_transport_data IS INITIAL.

lv_applname

CALL METHOD cl_bsp_dlc_config_util=>transport_init EXPORTING

= ls_config_key-component.

iv_applname

= lv_applname

IMPORTING ev_transport_data = lv_transport_data

ev_display_mode

= lv_disp_mode.

SPLIT lv_transport_data AT '/' INTO ls_transport_data-request lv_dummy_string. ls_transport_data-display_mode = lv_disp_mode. ENDIF.

IF ls_transport_data-display_mode IS NOT INITIAL. EXIT. "CONTINUE. ENDIF.

CALL METHOD cl_bsp_dlc_storage_util=>copy_config EXPORTING

iv_from_component

iv_from_viewname

iv_from_role_key

iv_from_component_usage = ls_config_key-component_usage

iv_from_object_type

iv_from_object_sub_type = ls_config_key-object_sub_type

= ls_config_key-component = ls_config_key-viewname = p_frole

= ls_config_key-object_type

iv_to_component iv_to_viewname iv_to_role_key iv_to_component_usage iv_to_object_type iv_to_object_sub_type is_transport_data

= ls_config_key-component = ls_config_key-viewname = p_torole = ls_config_key-component_usage = ls_config_key-object_type = ls_config_key-object_sub_type = ls_transport_data

EXCEPTIONS config_not_found

= 1

failed

= 2

OTHERS IF sy-subrc <> 0. CONTINUE. ENDIF. ENDIF. ENDLOOP.

= 3.

ENDIF.

ENDIF.

Useful Information Mass copy UI screen configurations from one role key to another in CRM.

Useful Information Mass copy UI screen configurations from one role key to another in CRM.