With SAP S/4HANA, many organizations are implementing HCM-Business Partner Integration with automatic supplier and customer creation processes. This allows employees to also be maintained as customers in the system.
To get more detailed information for HCM-Business Partner- Integration, please have a look at this blog posts:
New Employee Business Partner Data Model in SAP S/4HANA 2020 On-Premise
External Workforce and Customer Role in New Employee Business Partner Data Model
To use an employee as a "full" customer, sales-dependent data needs to be entered manually.
Here is a way to extend a customer by additional Company Codes and Sales areas.
This scenario is commonly used in consumer industries where an employee buys products from different organizational units within the company.
For example, an employee employed in Company Code DE01 may want to buy products from both DE01 (e.g. phones) and DE02 (e.g. displays), where DE01 and DE02 are related to the same enterprise.
The standard behavior of Employee-Business Partner-Customer integration only creates Company Code data for the employee's own Company Code, without Sales Area data.
To extend the customer master data, you can use a Business Add-In (BAdI) that is called during the HCM-Business Partner synchronization process.
Based on a custom control table and data from a reference Business Partner, you can extend the current employee customer during synchronization to include additional Company Codes and Sales Areas. This allows the employee to be maintained as a customer across multiple organizational units, beyond just their assigned Company Code.
The BAdI /SHCM/B_EP_BP_ROLE_SYNC can be used to modify customer data including general data, company code information, roles, etc. during the synchronization process. Report /SHCM/R_EMPL_HANDLE_BPROLES is used to handle the role assignments for employee Business Partners.
By leveraging these customization options, you can extend the standard employee-customer integration to support more complex organizational scenarios where employees need to be maintained as customers across multiple Company Codes and Sales Areas. This provides more flexibility in how employee-customers are managed in S/4HANA.
This functionality is available starting from SAP S/4HANA 2022 FPS0 with the active Business Function /SHCM/EE_BP_1, which enables the New Employee Business Partner Model.
In the customization view PTRV_VENDOR_SYNC (Synchronize HR data to supplier), the option "Customer" or "Customer and Vendor" must be activated.
You can access this view via transaction SM30 or through IMG: Personnel Management -> SAP S/4HANA for Human Resources -> Synchronize Business Partners with Active Business Partner Integration -> Define Default Data for Employees in Role FI Supplier/Customer.
To check the organizational assignment, use transaction PA20 to view the employee master data and navigate to the Infotype "Organizational assignment."
As illustrated, employee 56 is assigned to Company Code DE01. In conjunction with the customization view PTRV_VENDOR_SYNC, the Business Partner for employee 56 will be extended to include customer and vendor roles with Company Code data for DE01. The primary purpose is to use vendor data for travel expenses and customer data as baseline information for customer processes.
You can verify all related employee objects linked to HCM-Business Partner integration by using transaction /SHCM/EE_BP_RLTN.
Upon investigation, you will see that the employment Business Partner includes only the Financial Roles FLCU00 and FLVN00, alongside role BUP010.
I opted to use a custom control table to determine which employee Company Codes will require the creation of additional Company Codes and Sales Areas. Here's an example of my custom table:
Perhaps you noticed that the Employee Company Code and Additional Company Code are the same, in this case, DE01. This setup is intentional for usability purposes, providing a clear view of Company Code and Sales Area assignments.
The Reference Business Partner (in my case EE00000000) is crucial for defining default values used during data synchronization/creation. Ensure the Reference Business Partner is extended with relevant Company Codes and Sales Areas. In my scenario, I added Company Code DE02 to both customer and vendor roles. Additionally, I included Sales Areas 0001/01/01 and 0002/01/01 in the customer role, serving as a template.
Create a new BAdI Implementation for BAdI /SHCM/EP_BP_ROLE_SYNC. Various methods are provided, and I used the method /SHCM/IF_B_EP_BP_ROLE_SYNC~MODIFY_ALL because it encompasses the full set of data, including Sales Area information. Below is a coding example for your implementation, which illustrates the general functionality. Note that there may be additional side effects that need to be assessed in your implementation. This example serves as a valuable starting point.
METHOD /shcm/if_b_ep_bp_role_sync~modify_all.
CONSTANTS: lc_customer TYPE bu_partnerrole VALUE 'FLCU01'.
DATA: ls_ptrv TYPE ptrv_vendor_sync,
lv_curr_bukrs TYPE bukrs,
ls_cust_link TYPE v_cvi_cust_link,
lt_customers TYPE cmds_ei_extern_t,
ls_customers TYPE cmds_ei_extern,
ls_ref_bp TYPE cmds_ei_main,
ls_ref_cust TYPE cmds_ei_main,
lt_zrole TYPE TABLE OF zbp_role_sync,
ls_zrole TYPE zbp_role_sync,
lv_bukrs_new TYPE bukrs,
ls_sa_new TYPE cmds_ei_sales_key,
ls_cust_cc TYPE cmds_ei_company,
lv_knb1 TYPE knb1,
ls_cust_sa TYPE cmds_ei_sales,
lv_knvv TYPE knvv.
FIELD-SYMBOLS: <fs_customers> TYPE LINE OF cmds_ei_extern_t,
<fs_cust_cc> TYPE cmds_ei_company,
<fs_cust_sa> TYPE cmds_ei_sales.
* check if role FLCU01 is assigned
READ TABLE cs_bp_data-partner-central_data-role-roles
WITH KEY data_key = lc_customer
TRANSPORTING NO FIELDS.
IF sy-subrc = 0.
* customer sales role FLCU01 is relevant
* get reference BP
lv_curr_bukrs = is_employee_data-org_assignment-bukrs.
CLEAR ls_ptrv.
SELECT SINGLE * FROM ptrv_vendor_sync INTO @LS_ptrv
WHERE bukrs = @LV_curr_bukrs.
IF ls_ptrv IS NOT INITIAL.
* get reference customer BP number
SELECT SINGLE * FROM v_cvi_cust_link INTO @LS_cust_link
WHERE partner = @LS_ptrv-ref_vendor.
* read reference customer data
APPEND INITIAL LINE TO lt_customers ASSIGNING <fs_customers>.
<fs_customers>-header-object_instance-kunnr = ls_cust_link-kunnr.
<fs_customers>-header-object_task = 'U'.
ls_ref_bp-customers = lt_customers.
cmd_ei_api_extract=>get_data(
EXPORTING
is_master_data = ls_ref_bp
IMPORTING
es_master_data = ls_ref_cust ).
* data selection from z-table ZBP_ROLE_SYNC
SELECT * FROM zbp_role_sync INTO TABLE @LT_zrole
WHERE empcc = @LV_curr_bukrs.
LOOP AT lt_zrole INTO ls_zrole.
lv_bukrs_new = ls_zrole-addcc.
ls_sa_new-vkorg = ls_zrole-vkorg.
ls_sa_new-vtweg = ls_zrole-vtweg.
ls_sa_new-spart = ls_zrole-spart.
LOOP AT ls_ref_cust-customers INTO ls_customers.
* add additional company code
LOOP AT ls_customers-company_data-company INTO ls_cust_cc.
IF ls_cust_cc-data_key-bukrs = lv_bukrs_new.
READ TABLE cs_bp_data-customer-company_data-company
WITH KEY data_key-bukrs = lv_bukrs_new
TRANSPORTING NO FIELDS.
IF sy-subrc <> 0.
APPEND INITIAL LINE TO cs_bp_data-customer-company_data-company ASSIGNING <fs_cust_cc>.
MOVE-CORRESPONDING ls_cust_cc TO <fs_cust_cc>.
<fs_cust_cc>-task = 'I'.
<fs_cust_cc>-data-pernr = is_employee_data-pernr.
<fs_cust_cc>-datax-pernr = abap_true.
SELECT SINGLE * FROM knb1 WHERE
kunnr = @CS_bp_data-customer-header-object_instance-kunnr AND
bukrs = @LV_bukrs_new
INTO CORRESPONDING FIELDS OF @LV_knb1.
IF lv_knb1 IS NOT INITIAL.
<fs_cust_cc>-task = 'U'.
ENDIF.
ENDIF.
ENDIF.
ENDLOOP.
* add additional sales area
LOOP AT ls_customers-sales_data-sales INTO ls_cust_sa.
IF ls_cust_sa-data_key = ls_sa_new.
READ TABLE cs_bp_data-customer-sales_data-sales
WITH KEY data_key = ls_sa_new
TRANSPORTING NO FIELDS.
IF sy-subrc <> 0.
APPEND INITIAL LINE TO cs_bp_data-customer-sales_data-sales ASSIGNING <fs_cust_sa>.
MOVE-CORRESPONDING ls_cust_sa TO <fs_cust_sa>.
<fs_cust_sa>-task = 'I'.
SELECT SINGLE * FROM knvv WHERE
kunnr = @CS_bp_data-customer-header-object_instance-kunnr AND
vkorg = @LS_sa_new-vkorg AND
vtweg = @LS_sa_new-vtweg AND
spart = @LS_sa_new-spart
INTO CORRESPONDING FIELDS OF @LV_knvv.
IF lv_knvv IS NOT INITIAL.
<fs_cust_sa>-task = 'U'.
ENDIF.
ENDIF.
ENDIF.
ENDLOOP.
ENDLOOP.
ENDLOOP.
ENDIF.
ENDIF.
ENDMETHOD.
After completing these steps, you should be able to extend Employment Business Partners with additional Company Codes and Sales Areas as specified in your custom control table. Execute the report /SHCM/R_EMPL_HANDLE_BPROLES to perform role synchronization.
To verify the extended Employment Business Partner, use transaction /SHCM/EE_BP_RLTN.
For more detailed information about Employment Business Partner EE00000056, click on the Business Partner Number, leading you to transaction BP. Here, select role FLCU01 (Customer) and navigate to Sales and Distribution data.
As you can see, the system has added Sales Areas 0001/01/01 and 0002/01/01, incorporating all relevant data from the Reference Business Partner. You are now able to create Sales Orders for this Employee.
I hope this blog post was helpful for you. I'm looking forward to your feedback and thoughts or clarification questions you may have in the comment section below.
Brought to you by the SAP S/4HANA RIG and Customer Care team.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
8 | |
5 | |
4 | |
3 | |
3 | |
2 | |
2 | |
2 | |
2 | |
2 |