You are on page 1of 18

Note 2326343

Note:

a. All the enhancement mentioned in this document should be created in Customer Namespace
and should be saved in a Custom Package
b. It is recommended to create Z-object with same name as shown in screen shots.

1. Addition of attribute GT_ATTRIBUTE_INDICATOR in interface IF_BOL_BO_PROPERTY_ACCESS

In Transaction SE24, open interface IF_BOL_BO_PROPERTY_ACCESS and create the


enhancement implementation.

To enhance the interface, select the “Interface” from the menu options and choose the
“Enhance” option as per below screenshots:
Provide the “Enhancement Implementation” and “Short Text” then press continue.

Suggested Enhancement implementation Name: ZENH_UIMWUI_PROPERTY_ACCS

Suggested Short Text: Enhancement for UI data protection masking

Add instance attribute GT_ATTRIBUTE_INDICATOR of type


/UIMWUI/TT_ATTRIBUTE_INDICATOR.

Go to Attributes tab and add instance attribute GT_ATTRIBUTE_INDICATOR with below details

Attribute Level Typing Associated Type


GT_ATTRIBUTE_INDICATOR Instance Type /UIMWUI/TT_ATTRIBUTE_INDICATOR
Attribute

Screen shot:
2. Creation of new method ZWUI_ON_BEFORE_OUTPUT along with methods DO_REQUEST and
IF_BSP_CONTROLLER~HANDLE_EVENT enhancement in class CL_BSP_WD_VIEW_CONTROLLER

Select the menu option “Class” and choose “Enhance” to create the enhancement
implementation.

Provide the “Enhancement Implementation” name and “Short Text” then press continue.

Suggested Enhancement Implementation Name: ZENH_UIMWUI_WD_VIEW_CONTR

Suggested Short Text: Enhancement for UI data protection masking


Create an instance method ZWUI_ON_BEFORE_OUTPUT with visibility PROTECTED inside the
class enhancement.

Method Level Visibility


ZWUI_ON_BEFORE_OUTPUT Instance Method Protected

To this method ZWUI_ON_BEFORE_OUTPUT, attach the event “BEFORE_OUTPUT”

To attach the event “BEFORE_OUTPUT”, place the cursor over method


ZWUI_ON_BEFORE_OUTPUT in change mode and select the button “Go to Properties” as
marked in below screenshot:

Provide the description “Before Output Event” in popup prompted then select the check box
“Event Handler for” and mention the class “CL_BSP_WD_VIEW_CONTROLLER” along with event
“BEFORE_OUTPUT” then click on change button as shown in below screenshot:
The method should show an event attached to it as shown below:

Now, go to the parameters of the method ZWUI_ON_BEFORE_OUTPUT and provide the


parameter name ‘SENDER’ and hit enter button, system will take the type as importing
automatically as shown in below screenshot:

Event BEFORE_OUTPUT has been attached to the method ZWUI_ON_BEFORE_OUTPUT. Now,


Insert the below code in method:
" Data Declaration.
DATA : lv_component TYPE string,
lv_view_id TYPE o2page,
lv_view TYPE string,
lv_view_name TYPE o2page,
lv_ext TYPE string,
lv_result TYPE string,
lv_compname TYPE string,
lv_comp_name TYPE bsp_wd_component_name,
lt_context_node TYPE /uimwui/tt_context_node,
lv_mask TYPE abap_bool.
* lr_mask_frwrk TYPE REF TO zcl_wui_masking_frwrk.

" Field Symbols.


FIELD-SYMBOLS : <lr_context> TYPE REF TO cl_bsp_wd_context,
<ls_node> TYPE lbsp_model_item.

" Check if the Global Mask is set.


CALL METHOD /uimwui/cl_utility=>is_global_mask_set_core
RECEIVING
rv_global_mask = lv_mask.
IF lv_mask EQ abap_false.
RETURN.
ENDIF.

IF sender IS BOUND.

" Component Name.


lv_component = sender->view_id.
TRANSLATE lv_component TO UPPER CASE.
SPLIT lv_component AT '/' INTO lv_comp_name lv_view_id.

" View Name.


lv_view = sender->view_name.
TRANSLATE lv_view TO UPPER CASE.
SPLIT lv_view AT '.' INTO lv_view_name lv_ext.

" Context Nodes.


LOOP AT sender->m_models ASSIGNING <ls_node>.
lv_result = <ls_node>-model_id.
TRANSLATE lv_result TO UPPER CASE.
APPEND lv_result TO lt_context_node.
ENDLOOP.

" Context.
TRY.
ASSIGN sender->('CONTEXT') TO <lr_context>.
CATCH cx_root.
RETURN.
ENDTRY.

IF <lr_context> IS ASSIGNED.

CALL METHOD /uimwui/cl_dispatcher=>view_controller


EXPORTING
iv_component_name = lv_comp_name
iv_view_name = lv_view_name
iv_view_id = lv_view_id
it_context_node = lt_context_node
ir_context = <lr_context>.
ENDIF.

ENDIF.

The final method should look like as shown on next page:


In Transaction SE24, open method DO_REQUEST of class CL_BSP_WD_VIEW_CONTROLLER and
create implicit enhancement at the start of method.

To create implicit enhancement at the start of method DO_REQUEST, click on “Enhance” button
as marked in below screenshot:

Select the option Edit->Enhancement Operations->Show Implicit Enhancements Options as


shown in screenshot:

Place the cursor over marked line shown for Implicit Enhancement Option and click on button
“Create” to create Enhancement Implementation as per below screenshot:
Choose Enhancement Mode as “Code”:

Provide the “Enhancement Implementation” and “Short Text” in “Create Enhancement


Implementation” popup then click on marked button:

Suggested Enhancement Implementation Name: ZENH_UIMWUI_IMPL_VIEW_CONTROLL

Suggested Short Text: UI Data protection masking

Insert the following lines of code inside implicit enhancement:

"--------------Start of masking hook for CRM--------------


DATA : lv_mask TYPE abap_bool.

CALL METHOD /uimwui/cl_utility=>is_global_mask_set_core


RECEIVING
rv_global_mask = lv_mask
.
IF lv_mask EQ abap_true.
* calling the event handler
SET HANDLER zwui_on_before_output FOR me .
ENDIF.
"--------------End of masking hook for CRM--------------

The code should look like as shown below:


In Transaction SE24, open method IF_BSP_CONTROLLER~HANDLE_EVENT of class
CL_BSP_WD_VIEW_CONTROLLER and create implicit enhancement at the start of method

To create implicit enhancement at the start of method, click on “Enhance” button as marked
below:

Select the option Edit->Enhancement Operations->Show Implicit Enhancements Options as


shown in screenshot:
Place the cursor over marked line shown for Implicit Enhancement Option and click on button
“Create” to create Enhancement Implementation as per below screenshot:

Choose Enhancement Mode as “Code”.

Provide the “Enhancement Implementation” and “Short Text” in “Create Enhancement


Implementation” popup then continue:

Suggested Enhancement Implementation Name: ZENH_UIMWUI_IMPL_VIEW_CONTROLL

Suggested Short Text: UI Data protection masking


Insert the following lines of code inside implicit enhancement:

"--------------Start of masking hook for CRM--------------


* To disable row selection
DATA: lv_global_mask TYPE abap_bool.

*Calling method to get global masking switch configuration


CALL METHOD /uimwui/cl_utility=>is_global_mask_set_core
RECEIVING
rv_global_mask = lv_global_mask.

*Return,If global masking switch configuration is not set


IF lv_global_mask IS NOT INITIAL.
*if global masking switch configuration is set, Call the dispatcher method
CALL METHOD /uimwui/cl_dispatcher=>handle_event
EXPORTING
ir_view_controller = me
ir_request = request
ir_htmlb_event_ex = htmlb_event_ex
ir_global_messages = global_messages
iv_view_id = view_id
ir_component_controller = comp_controller.
ENDIF.
"--------------End of masking hook for CRM--------------

The code should look like as shown below:


3. Creation of new method UIMWUI_GET_DETAILS in class CL_BSP_MODEL

In Transaction SE24, create a method UIMWUI_GET_DETAILS with following details in table:


Method Level Visibility Description
UIMWUI_GET_DETAILS Instance Method Protected Get details

Note: You may refer step2 which contains the detail steps to create an enhancement
implementation of class
Add two parameters er_owner and ev_id to the new method UIMWUI_GET_DETAILS.

Go to the parameters of method, add two exporting parameters ER_OWNER and EV_ID by
providing associated type as shown below:

Parameter Type Typing Method Associated Type


ER_OWNER Exporting Type Ref To CL_BSP_CONTROLLER2
EV_ID Exporting Type STRING

Screen shot:

Insert the following lines of code inside newly created method uimwui_get_details:

METHOD uimwui_get_details.
er_owner = owner.
ev_id = id.
ENDMETHOD.

Screen shot:
4. Enhancement of method GET_S_STRUCT of class CL_BSP_WD_CONTEXT_NODE

In Transaction SE24, open method GET_S_STRUCT of class CL_BSP_WD_CONTEXT_NODE and


create an implicit enhancement at the end of method.

Insert the following lines of code inside implicit enhancement:

"--------------Start of masking hook for CRM--------------


DATA lv_global_mask TYPE abap_bool.
DATA lr_owner TYPE REF TO CL_BSP_CONTROLLER2.
DATA lv_id TYPE string.
*Step 1:Checking for Global masking indicator
CALL METHOD /uimwui/cl_utility=>is_global_mask_set_core
RECEIVING
rv_global_mask = lv_global_mask. " Boolean
IF lv_global_mask IS INITIAL.
RETURN.
ENDIF.
*Step 2:geting Owner and ID
CALL METHOD uimwui_get_details
IMPORTING
er_owner = lr_owner
ev_id = lv_id
.
*Step 3:geting masking string

CALL METHOD /uimwui/cl_dispatcher=>get_attribute_mask_data


EXPORTING
iv_attribute_path = attribute_path
ir_context_node = me " WD Context Node
ir_owner = lr_owner " BSP-Komponente
iv_id = lv_id
CHANGING
cv_input_output_string = value "Output Value
.
"--------------End of masking hook for CRM--------------

Screen shot: On next page.


5. Enhancement of method DO_REQUEST in Class CL_BSP_WD_VIEW_MANAGER

To save the details in a log table for field access tracking for a configured field, create
enhancement in method DO_REQUEST of Class CL_BSP_WD_VIEW_MANAGER.

In Transaction SE24, open method DO_REQUEST of the class CL_BSP_WD_VIEW_MANAGER and


create implicit enhancement at the end of the method.
Insert the following lines of code inside implicit enhancement:

"--------------Start of masking hook for CRM--------------


" Data declaration
DATA : lv_mask TYPE abap_bool.

* Call method to check if global masking flag is switched on or not


CALL METHOD /uimwui/cl_utility=>is_global_mask_set_core
RECEIVING
rv_global_mask = lv_mask
.
* If masking flag is OFF then return.
IF lv_mask eq abap_false.
RETURN.
ENDIF.

* Call method to handle BADI implementation in dispatcher class


CALL METHOD /uimwui/cl_dispatcher=>handle_logs.
"--------------End of masking hook for CRM--------------

Screen shot:

6. Enhancement of method GET_T_TABLE in class CL_BSP_WD_CONTEXT_NODE_TREE

To perform masking for unauthorized user on the CRM Tree, create implicit enhancement at the
end of the method GET_T_TABLE in class CL_BSP_WD_CONTEXT_NODE_TREE
Insert the following lines of code inside implicit enhancement:

"--------------Start of masking hook for CRM--------------

DATA lv_global_mask TYPE abap_bool.


DATA lr_owner TYPE REF TO CL_BSP_CONTROLLER2.
DATA lv_id TYPE string.

*Step1:Check for global masking


CALL METHOD /uimwui/cl_utility=>is_global_mask_set_core
RECEIVING
rv_global_mask = lv_global_mask. " Boolean
IF lv_global_mask IS INITIAL.
RETURN.
ENDIF.
*Step 2:geting Owner and ID
CALL METHOD uimwui_get_details
IMPORTING
er_owner = lr_owner
ev_id = lv_id
.
*Step 3:geting masking string
CALL METHOD /uimwui/cl_dispatcher=>get_attribute_mask_data
EXPORTING
iv_attribute_path = attribute_path
ir_context_node = me " WD Context Node
ir_owner = lr_owner " BSP-Komponente
iv_id = lv_id
CHANGING
cv_input_output_string = value "Output Value
.
"--------------End of masking hook for CRM--------------

Screen shot:

You might also like