Enterprise Resource Planning Blogs by SAP
Get insights and updates about cloud ERP and RISE with SAP, SAP S/4HANA and SAP S/4HANA Cloud, and more enterprise management capabilities with SAP blog posts.
cancel
Showing results for 
Search instead for 
Did you mean: 
Andi_M
Product and Topic Expert
Product and Topic Expert
At Business Partner creation you have to decide which role you want to use for your Business Partner.

Unfortunately there is no restriction of Business Partner Roles depending on Business Partner Grouping selected. The only restriction of available roles is dependent on selected Business Partner Type (Person, Organization, Group).

In this blog I will describe a way how to reduce available Business Partner Roles based on selected Business Partner Grouping.

Introduction


The purpose of this blog is to describe how to influence available Business Partner Roles at Business Partner creation.

Target audience: Functional Experts

Version: SAP S/4HANA On Premise 1610 and higher

A detailed description of used BAdI BUPA_ROLE_INFLUENCE you will find at SAP Note 2571755 - Provision to influence Business Partner roles in Business Partner transaction.

This blog can be used as a next step of solution described at blog

SAP S/4HANA Business Partner restrict Business Partner Grouping at creation

After starting transaction BP you selected a Business Partner Type and a Business Partner Grouping. You will see a screen like this.


As you can see there are all Business Partner Roles displayed which are possible for Business Partner Type Person.

Target is to reduce available Business Partner Roles to this two entries if you select Business Partner Grouping '0200 Contact Person'.

000000 Business Partner (Gen.)

BUP001 Contact Person

To create a Contact Person Business Partner technically it is enough to use Business Partner Role 000000 Business Partner (Gen.). Therefore this Role will be the default value. Optional the user can select Business Partner Role BUP001 Contact Person.

Foundation is a custom customizing table where possible combinations of Business Partner Grouping and Business Partner Roles are stored.

Create control table


To define allowed Business Partner Roles per Business Partner Groupings you have to create customizing table (inclusive table maintenance screen) in customer name space which you can maintain via transaction SM30.


 

Hint: If you use Business Partner Role Groupings defined in customizing table TB003G you should replace field ROLE by a field of type CHAR6. If you do so you are able to store single roles and role groupings at the same customizing table. You have to adjust the coding a bit.

 

At this example only Business Partner Roles 000000 and BUP001 are allowed for Business Partner Grouping 0200 (Contact Person).



BAdI Implementation


Create an implementation for BAdI BUPA_ROLE_INFLUENCE at transaction SE19.

Implement following example coding at method IF_EX_BUPA_ROLE_INFLUENCE~INFLUENCE_ROLES.
  METHOD if_ex_bupa_role_influence~influence_roles.

DATA: lt_role TYPE TABLE OF zbp_group_role,
ls_values TYPE LINE OF bus_screen-dropdown_values,
lv_sytabix TYPE sy-tabix.

CHECK NOT ct_possible_roles IS INITIAL.

SELECT * FROM zbp_group_role INTO TABLE lt_role WHERE bu_group = cv_number_group.

IF NOT lt_role IS INITIAL.
LOOP AT ct_possible_roles INTO ls_values.
lv_sytabix = sy-tabix.
READ TABLE lt_role WITH KEY role = ls_values-key TRANSPORTING NO FIELDS.
IF sy-subrc NE 0.
DELETE ct_possible_roles INDEX lv_sytabix.
ELSE.
lv_sytabix = lv_sytabix + 1.
ENDIF.
ENDLOOP.
ENDIF.

* set default role (first in table)
SORT ct_possible_roles BY key.
READ TABLE ct_possible_roles INDEX 1 INTO cv_default_role.

ENDMETHOD.

Test transaction BP


If you now run transaction BP and create a person with Business Partner Grouping 0200 (Contact Person) you will see the reduced available Business Partner Roles.


 

Business Partner Role 000000 has been set as default role.