Hi Ankesh,
As explained in the earlier post, you can achieve using the Enahancement shot CRM_UIU_BP_ENHANCEMENT Badi BADI_CRM_BP_UIU_DEFAULTS.
In the Implementation of this Badi, you have to find the current Business role by using the below code.
V_PROFILE ?= CL_CRM_UI_PROFILE=>GET_INSTANCE( ).
CALL METHOD V_PROFILE->IF_CRM_UI_PROFILE~GET_PROFILE
RECEIVING
RV_RESULT = V_ROLE.
Then After based on your logic you have to default the values.
Sample Code:
TRY .
lr_acc_det_impl ?= cr_me.
lr_entity_props = lr_acc_det_impl->typed_context->header->collection_wrapper->get_current( ).
CALL METHOD lr_entity_props->get_property_as_string
EXPORTING
iv_attr_name = 'BP_GROUP'
RECEIVING
rv_result = lv_bp_group.
IF lv_bp_group NE 'ZCOM'.
CALL METHOD lr_entity_props->get_property_as_string
EXPORTING
iv_attr_name = 'BP_ROLE'
RECEIVING
rv_result = lv_role.
ELSE.
lv_role = 'CRM005'.
CALL METHOD lr_entity_props->set_property_as_string "===>Setting the BP_ROLE as 'PROSPECT'.
EXPORTING
iv_attr_name = 'BP_ROLE'
iv_value = lv_role.
ENDIF.
CATCH cx_sy_conversion_error .
CATCH cx_sy_move_cast_error.
CATCH cx_root.
ENDTRY.
Thanks and Regards,
Y. Ravi Kumar