SAP-BP Tcode Hide roles in Dropdown

SAP transaction BP - Hide the BP roles in Dropdown

In using SAP-BP Tcode hide roles in Dropdown transactions could be for customer, vendor and lot of other Business partners(internal and external) in the system. Additionally, SAP has a set of predefined roles for each of the business partner which can be seen as a dropdown as below in SAP-BP Tcode hide roles in Dropdown

  1. How the screen looks currently 
  2. Config based control 
  3. Conditional restriction for dropdown
  4. Additionally, Other BADIs which can be used  

Furthermore, Please read on to find more below

How the screen looks currently

Below is the screenshot of how the roles look like currently and then 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

 

SAP-BP Tcode Hide roles in Dropdown

Config based Control

Moreover, Below is the config point.  
SPRO->Cross-application Components ->Sap Bussiness Partner ->Bussiness Partner -> Basic Settings -> Business Partner Roles -> Define BP Roles

Additionally, Refer note which has the screenshot explaining this setting  

2813078 - How to hide BP role/BP role grouping on BP screen 

 

SAP-BP Tcode Hide roles in Dropdown

Conditional Restriction for the SAP BP Tcode hide role in Dropdown

Conditional Viewing of roles based on predefined business condition for instance role assigned to the user   

Moreover 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 

Furthermore, I created a user exit for this method as a Post exit from now on

Logic as below:  

  1. Read the specific BP being opened by the user 
  2. Then restrict for a specific BP grouping or number range 
  3. Get the roles for the user and then check for the role combination which you want to show / hide a specific tab
  4. And then based on the condition hide/ show the specific item in dropdown menu 
*lv_string1 = IV_PARTNER_NUMBER+0(1). 
Select single partner_guidfrom but000 into ls_but000 where partner_guid= IV_PARTNER_GUID . 
  if sy-subrcEQ 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_rolesTYPE xfeld. 
 
        lv_string= 'ZVENDOR_ROLE'. 
* convert retrieved value to range table 
* Add your condition here; 
* if else endif.  
        LOOP AT lt_rolesINTO DATA(ls_role). 
          READ TABLE lt_groupsINTO ls_groupWITH KEY agr_name= ls_role. 
          IF sy-subrcEQ 0.  " Vendor matching role exist 
            lv_delete_roles= 'X'.  "so delete the other roles 
            EXIT. 
          ENDIF. 
        ENDLOOP. 
 
        IF  lv_delete_rolesIS NOT INITIAL. 
          FIELD-SYMBOLS: <fs_struct> TYPE any. 
          FIELD-SYMBOLS <fv_value> TYPE any. 
          DATA: lv_tabixTYPE sy-tabix. 
 
          LOOP AT it_possible_rolesASSIGNING <fs_struct>  . 
* 
            lv_tabix= sy-tabix. 
            ASSIGN COMPONENT  'ROLE' OF STRUCTURE <fs_struct> TO <fv_value> . 
* 
            IF   <fv_value> IS ASSIGNED AND  ( ( <fv_value> =  '000000' ) OR ( <fv_value> = 'FLVN00' ) OR ( <fv_value> = 'FLVN01' ) ) . 
            ELSE. 
 
              DELETE it_possible_rolesINDEX lv_tabix.. 
*              DELETE gt_partner_role_values INDEX lv_tabix. 
 
            ENDIF. 
 
          ENDLOOP. 
 
        ENDIF. 
 
*ENDiF. 
      ENDIF. 

 

 

 

Other BADIs which can be used

However you could also use one of the BADIs below but I was not able to make them work for the specific requirement I had.  
BUPA_BLOCK_ROLES_REMOVE   
BUPA_ROLE_CHECK -   
BUPA_ROLES_UPDATE  - Only run specific to a BP when the Vendor Loads.  

Read more here https://blogs.sap.com/2020/10/17/sap-bp-tcode-hide-role-in-dropdown/

Additionally, Let us know if you found the article useful and Do read our SAP Service offering page here: 

If you have any business inquiry then please feel free to contact us  

Get In Touch If You Have A Business Query