Skip to Content
Technical Articles
Author's profile photo Andi Mauersberger

SAP S/4HANA Business Partner Relationship – Automatic company address assignment

Introduction

 

This blog is based on S/4HANA OP1610 release and relevant as well for subsequent releases of S/4HANA.

May be you feel tired to push additional button in Business Partner Relationship to assign company address to a Contact Person. Sometimes it will forgotten and you are not able to see relationship specific company address.

This blog describes a way how to avoid to press this button and assign company address automatically.


First some Background.

With S/4HANA Customer Vendor Integration (CVI) is active and BP transaction is the leading transaction to create/change/display Business Partners, Customers, Vendors. In ECC release Contact Persons are stored in table KNVK and available in process documents related to Customers/Vendors.

To trigger creation of KNVK entry following Point are mandatory:

  1. Contact Person synchronization is activated in CVI synchronization setup
  2. Business Partner is created in at least Custumer or Vendor role
  3. Contact Person is created as Business Partner (role 000000-General Business Partner is enough)
  4. You are creating Business Partner Relationship with Relationship Category BUR001-Contact Person

This prerequisits will trigger CVI and creates KNVK entry.

Important is to assign company address in relationship creation. This will create a relationship specific address entry which address number you will find in KNVK as well.

 

Starting Point – Standard way

  1. Maintain Business Partner in role Customer/Vendor role navigate into Relationship area
  2. At Relationship screen choose Relationship Category ‘Has Contact Person’
  3. Enter Business Partner number of Contact Person and push button ‘Create’
  4. At the next screen you have to push the button ‘Assign Company Address’
  5. Company address is assigned and phone number is set as default

 

Implementation

The point where this change becomes active is the event PBO (Process Before Output) at Relationship screen where this button placed. We will create our own PBO function module based on the standard Function Module and do our enhancement.

  1. Navigate into screen control of view BUR090 at BDT (Business Data Toolset)
    Transaction BUBE and navigate into view BUR090 via double klick.
  2. Copy Function Module name from field ‘Before Output’. This is the field where we will assign our new Z-Function Module
  3. Open transaction SE37 in a new session and create a new function module in customer name space. Please use original name as part of new function module name to follow BDT naming convention. e.g ZCUST_BUR_BUPR_PBO_BUR090
  4. Use the following coding as an example
    FUNCTION zcus_bur_bupr_pbo_bur090.
    *"--------------------------------------------------------------------
    *"*"Lokale Schnittstelle:
    *"--------------------------------------------------------------------
      DATA: ls_but000  LIKE but000,
            ls_but050  LIKE but050.
      DATA: l_xhandle  TYPE c.
      DATA: l_fcode    LIKE tbz4-fcode VALUE 'BURA',
            l_crsfield LIKE bus000tbfl-tbfld VALUE 'BUS051___I-PAFKT',
            lt_adcp    TYPE TABLE OF adcp.
    
      CALL FUNCTION 'BUR_BUPR_PBO_BUR090'.
    
      CHECK ( cvi_bdt_adapter=>get_activity( ) = cvi_bdt_adapter=>activity_change
            OR cvi_bdt_adapter=>get_activity( ) = cvi_bdt_adapter=>activity_create
            OR cvi_bdt_adapter=>get_activity( ) = cvi_bdt_adapter=>activity_modify
            OR cvi_bdt_adapter=>get_activity( ) = cvi_bdt_adapter=>activity_display  ).
    
    * check relationship type
      CALL FUNCTION 'BUB_BUPR_BUT050_GET'
        IMPORTING
          e_but050 = ls_but050.
      CHECK ls_but050-reltyp = 'BUR001'.
    
    
    * check whether address has been assigned already
      REFRESH: lt_adcp.
      CALL FUNCTION 'BUR_BUPR_ADCP_GET'
        TABLES
          t_adcp = lt_adcp.
      CHECK lines( lt_adcp ) = 0.
    
      CLEAR: ls_but000.
      CALL FUNCTION 'BUP_BUPA_BUT000_GET'
        IMPORTING
          e_but000 = ls_but000.
    
      IF NOT ls_but000-partner IS INITIAL.
    * check if company address has been assigned
    
          CALL FUNCTION 'BUR_BUPR_EVENT_FCODE'
            EXPORTING
              i_fcode    = l_fcode
              i_crsfield = l_crsfield
    *         I_CRSLINE  = 0
            IMPORTING
              e_xhandle  = l_xhandle.
    
      ENDIF.
    
    
    ENDFUNCTION.


  5. Assign this new Function Module to the view BUR090 and save the data.

 

Screen behaviour after enhancement

  1. Maintain Business Partner in role Customer/Vendor role navigate into Relationship area
  2. At Relationship screen choose Relationship Category ‘Has Contact Person’
  3. Enter Business Partner number of Contact Person and push button ‘Create’
  4. At the next screen you will see that company address has been assigned automatically

Assigned Tags

      14 Comments
      You must be Logged on to comment or reply to a post.
      Author's profile photo Adam Corby
      Adam Corby

      Listen, is that really cool? Have you ever thought of creating your own business profile and offering the services of this software to various companies? I think something really worthwhile could come out, for example, you could be a good companion for any company whose client base needs to be improved. If you are suddenly interested Get More Info I think you can start with Hong Kong, it’s the most popular there, you can go there in a few months.

      Author's profile photo Andi Mauersberger
      Andi Mauersberger
      Blog Post Author

      Hello Adam,

      thank you for your offer. I'm sure, you would miss my Blog posts 😉

      Author's profile photo Sunil Gopala Krishnan
      Sunil Gopala Krishnan

      Hello Sir,

      Thank you very much for the detailed explanation for automating the "Assign Company Address" during creation of contact person relationship. This is excellent.

      Sir,

      We have a similar situation. After go live to SAP S/4 HANA 1809 FPS02, we created many BP's with contact person relation without clicking the "Assign Company Address" button. So now the result is that email id's have not been updated for the contact persons and hence emails to contact persons are not going out from invoice and order acknowledgement outputs.

      Is there a way to mass update the existing contact person relations with "Assign Company Address"? How to mass update "Assign Company Address" for existing contact person relations?

      Author's profile photo Adi Mogilevsky
      Adi Mogilevsky

      Hi all

      in my situation I have same Vendor and Customer BP ID number, but they have different addresses and emails,and the Vendor has 2 bank accounts and several emails to Accounts Payable and Accounts Receivable departments, as well as for more complexity- multiple addresses, emails and other details in each Sales Area while Sales Organisation depicts a different state (and we have 7 in Australia).

      So how will you approach this with just extending the Customer to these Sales Areas without consuming an additional number from the system numerator, i.e. how to push the address related data to the Sales Area and use multiple addresses - one in each Sales Area?

      Thank you in advance for your suggestions .

      Adi

      Author's profile photo Sarah Chiv
      Sarah Chiv

      Hi Andi,

      thanks a lot for this blogpost, great functionality that makes our users happy as they have one click less to think about.

      However since implementation we do get error message "AM885 - Internal error - ADDR_PERS_COMP_ASSIGN call error" in the following scenario:

      • Create a new contact person relationship
      • In the details of the relationship, do not enter the mail and phone directly, but use the button "Further email address" and "Further phone numbers" to enter several mail adresses and phone numbers.
      • When coming back to the relationship screen the error comes up

      Have you had this problem by any chance and have an idea how to solve it?

      Regards,

      Sarah

       

       

      Author's profile photo Ajai Koya
      Ajai Koya

      Sarah,

      We are facing similar issue, did you found any solution for this ?

      Author's profile photo Sarah Chiv
      Sarah Chiv

      Hi Ajai,

      yes, I found a solution. The issue was that the automatic assignment was taking place a second time, when coming back to the relationship screen after entering further mails/phone numbers. To avoid the second assignment I adjusted the coding in ZBUR_BUPR_PBO_BUR090 the following way:

      ZBUR_BUPR_PBO_BUR090

      I hope that helps.

      Best regards,
      Sarah

      Author's profile photo Ajai Koya
      Ajai Koya

      Appreciate your quick response .
      Thank you so much.

      Author's profile photo Stephen Herlick
      Stephen Herlick

      Hi Sarah

      I am trying to implement this code.  Can you tell me where you defined the variable gv_parnr?

      Also, we have a program to automatically create a contact business partner and assign the contact to the main business partner but the Company Address is missing.  Do you know how to assign the company address to a contact when using  FM BAPI_BUPR_CONTP_CREATE?

       

      Thanks

      Stephen

      Author's profile photo Sarah Chiv
      Sarah Chiv

      Hi Stephen,

      it is defined globally in the the top include of the function group.

      Regards,

      Sarah

       

      Author's profile photo Hans Verreydt
      Hans Verreydt

      Hi Andi,

      Do you know if something like this is also possible when using the SAP Master Data Migration Cockpit?

      Regards,
      Hans

      Author's profile photo Andi Mauersberger
      Andi Mauersberger
      Blog Post Author

      Hi Hans,

      at Migration Cockpit this is done automatically. This blog is just for dialog process if you create a new relationship.

      Best Regards

      Andi

      Author's profile photo Hans Verreydt
      Hans Verreydt

      Hi Andi,

      Hmm, do you know if we need to fill in something special then in the excel template (Contact Tab)?

      because, we loaded some contacts, but we needed to do a manually action (assign company address) afterwards for those customers. The link was not fully made.

      Regards,
      Hans

      Author's profile photo Meenakshi Sundaram Prabhu
      Meenakshi Sundaram Prabhu

      Hi Andi.,

       

      Thanks for the blog. we have implemented this , but we are getting multiple company address on popup, so how to make only one default address has to assign automatically.