SAP S/4HANA Business Partner – Influence Customer Number

When creating a Business Partner it might be required to set your own customer number which differs from Business Partner number.

In this blog I will describe steps to influence customer number during Business Partner creation.

Introduction

Target audience: Functional Experts

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

A prerequisite of used BAdI CVI_CHANGE_LINK in CVI_CUSTOM_MAPPER extension point SAP Note 2387218 – Change the link assignments. has to implemented if necessary.

Following system setup has been done at my example.

Business Partner Grouping and Number Range:

BP Grouping Description Number Range From To external
CPD One-time (int.no.assgnmt) 02 0000100000 0000299999 no

 Customer Account Group and Number Range

Account Group Description Number Range From To external
CPD One-time (int.no.assgnmt) 02 0000100000 0000299999 yes

CVI Mapping of direction Business Partner -> Define Number Assignment for Direction BP to Customer

BP Grouping Description Account Group Description Same Number
CPD One-time (int.no.assgnmt) CPD One-time (int.no.assgnmt) yes

Hint: Same Number flag ensures that you are not forced to enter customer number manually at BP transaction.

In a standard case a Business Partner with number 100002 will be created and CVI mapping takes care that a Customer with number 100002 is created.

Target now is to change customer number during creation process that number 200002 is used instead.

Please be aware at Business Partner number range definition that you choose a number range which will never reach lowest customer number range. In my example Business Partner number should not reach number 200000.

At the end this blog should just describe how to work with BAdI CVI_CHANGE_LINK therefore a simple example has been choosen.

BAdI Implementation

Create your own implementation for BAdI CVI_CHANGE_LINK which is assigned to CVI_CUSTOM_MAPPER extension point.

Use Transaction SE18 with CVI_CUSTOM_MAPPER to get access to BAdI CVI_CHANGE_LINK

 

Set flag to activate

Only if the flag C_LINK is set to ‘X’ at method IF_EX_CVI_CHANGE_LINK~SET_CHANGE_CUST_LINK corresponding method IF_EX_CVI_CHANGE_LINK~CHANGE_CUST_LINK is called doing the number change.

  METHOD if_ex_cvi_change_link~set_change_cust_link.
    IF i_partner-central_data-common-data-bp_control-grouping = 'CPD'.
      c_link = 'X'.
    ENDIF.
  ENDMETHOD.

 

Change customer number

Due to the CVI mapping logic the system determines customer number 0000100001 (internal with leading zeros). In my example I just do a simple replace at 5th digit. Feel free to use your own logic which fits into your customer number range definition.

  method IF_EX_CVI_CHANGE_LINK~CHANGE_CUST_LINK.

*enter here your own additional requirement e.g. IF ..... statement if needed
    cs_cust_link-customer = I_PARTNER-HEADER-OBJECT_INSTANCE-BPARTNER.
    cs_cust_link-customer+4(1) = '2'.
    
  endmethod.

 

Implementation result

After implementation you will see following result:

Business Partner has number 100002 and corresponding customer has number 200002.

 

Original Article:
https://blogs.sap.com/2023/09/18/sap-s-4hana-business-partner-influence-customer-number/

ASK SAP EXPERTS ONLINE
Related blogs

LEAVE A REPLY

Please enter your comment!
Please enter your name here