In using BP transactions could be for customer, vendor and lot of other Business partners(internal and external) in the system. SAP has a set of predefined roles for each of the business partner which can be seen as a dropdown as below
Please read on to find more below
Below is the screenshot of how the roles look like currently. When you click on display it only shows the role assigned to the BP but clicking on change or create gives a whole drop down list as seen below
Below is the config point.
SPRO->Cross-application Components ->Sap Bussiness Partner ->Bussiness Partner -> Basic Settings -> Business Partner Roles -> Define BP Roles
Refer note which has the screenshot explaining this setting
2813078 - How to hide BP role/BP role grouping on BP screen
We can add custom logic based on which we can define
Check the class CL_IM_VKK_BUPA_ROLES_REMOVE and method
IF_BUPA_BLOCK_ROLES_REMOVE~REMOVE_ROLES_FROM_DROPDOWN
I created a user exit for this method as a Post exit
Logic as below:
*lv_string1 = IV_PARTNER_NUMBER+0(1).
Select single partner_guid from but000 into ls_but000 where partner_guid = IV_PARTNER_GUID .
if sy-subrc EQ 0 and iv_partner_number+0(1) NE 'E'.
*You can also use partner grouping instead of number range in below
IF ( iv_partner_number+0(1) = '0' AND ( iv_partner_number+4(1) = '9' OR iv_partner_number+4(1) = '7' ) ) . " M01
CALL FUNCTION 'BAPI_USER_GET_DETAIL'
EXPORTING
username = sy-uname
TABLES
activitygroups = lt_groups
return = lt_return .
DATA: lv_string TYPE string,
lv_delete_roles TYPE xfeld.
lv_string = 'ZVENDOR_ROLE'.
* convert retrieved value to range table
* Add your condition here;
* if else endif.
LOOP AT lt_roles INTO DATA(ls_role).
READ TABLE lt_groups INTO ls_group WITH KEY agr_name = ls_role.
IF sy-subrc EQ 0