Objective : Change View settings such as showing certain buttons like EDIT based on current logged in Business role.
Current logged in Business role can be obtained using method GET_PROFILE of Class CL_CRM_UI_PROFILE. We can derive view changes based on Business roles as well.
For eg, If the need is to restrict the user to EDIT view only in a certain Business role. this can be achieved by adding the logic in the placeholder wherein the buttons are configured & a simple code snippet like below can derive that logic.
Sample code -
Data : lr_profile type ref to CL_CRM_UI_PROFILE,
lv_role type string.
lr_profile ?= CL_CRM_UI_PROFILE=>get_instance().
call method lr_profile->if_crm_ui_profile~get_profile
RECEIVING
rv_result = lv_role.
If lv_role NE '<Z-Business role name>'.
Delete gt_button where on_click = 'EDIT'.
endif.