Skip to Content
Technical Articles
Author's profile photo Vladimir Latyshenko

Replication of Cost Centers to Employee Central with assignment to additional Generic Objects

Introduction

Program ODTF_REPL_CC is used for replication of Cost Centers from SAP ERP Controlling to Employee Central. It replicates the fixed set of fields: the Long Code prepended with the Controlling Area, the Short Code (aka External Cost Center ID), Start Date, Status, Name, Description, Legal Entity (aka Company Code) and Cost Center Manager.

The program uses IDoc ODTF_CCTR, which is built on basic type ODTF_CCTR01.

In this blog post, we will have a closer look at replication of Cost Centers with assignment to additional Generic Objects.

The reader will learn an alternative to extension of basic IDoc type ODTF_CCTR01.

Details

Let us assume that we want to replicate Cost Centers with assignment to Business Unit and Location. We intend to use these Generic Objects as Field Criteria on Department, Position and Job Information in order to restrict the list of Cost Centers available for selection.

Extension of ODTF_CCTR01 with use of transaction WE30 is not advisable, as the replication would also require a custom CPI package.

Standard CPI package ERPtoSuccessFactorsEmployeeCentralCostCenter processes only the above-mentioned fixed set of fields and cannot be extended.

If we use the standard package, we have to replicate the additional parameters via standard fields, for example the Long Code (which is externalCode) and the Short Code (which is costCenterExternalObjectId).

The Long Code of Cost Center

Let us assume that the code of Cost Center is meaningful and the fifth character represents the Business Unit. For example, Cost Centers ABCD1234567890 and ABCD9876543210 should be associated to Business Unit CORP. We can build this logic into the definition of Business Unit with use of a Custom Composite One-to-many Child Object, for example object cust_FifthCharOfCostCenterCode, as shown below.

Figure 1. An example of the Custom Composite One-to-many Child Object used for evaluation of Business Unit from Cost Center

Now the on-save Business Rule of object Cost Center can use object cust_FifthCharOfCostCenterCode to associate Cost Centers to Business Units, as shown in the code below.

rule() 
{
  if(true) 
  {
    CostCenter.cust_toBusinessUnit = lookup("cust_FifthCharOfCostCenterCode","parent","",
	["externalCode","==",substring(text:CostCenter.externalCode,start:"5",length:"1"),"",""]);
  }
}

Code 1. Body of the on-save Business Rule to associate Cost Center to Business Unit

Following the same logic, other fields can be used to assign Cost Centers to Generic Objects.

The Short Code of Cost Center

In standard solution, the Short Code of Cost Center (aka External Cost Center ID) can be used in replication of Employee Data from EC to ERP.

It is used with the following logic: if (1) the Use of External Cost Center ID is enabled in cluster VC_ECPAO_QRY_CFG and (2) field cost-center of HRIS Element jobInfo is replicated directly to field KOSTL of infotype Organizational Assignment (which means that Employees do not inherit Cost Centers from Organizational Management), then the replicated Cost Center is replaced with the value in field costCenterExternalObjectId.

However, as a rule, the Use of External Cost Center ID is disabled, as the Short Code of Cost Center (which is PA0001-KOSTL) is either equal to or can be evaluated from the Long Code (which is externalCode).

Let us assume that field costCenterExternalObjectId is not required for replication of the Short Code of Cost Center. If this is the case, we can utilize field costCenterExternalObjectId (which is 40 characters long) for replication of additional parameters of Cost Center, as shown in the code below.

  METHOD if_odtf_co_repl_idoc_cost_cent~modify_cost_center_extractor.
    LOOP AT cs_cost_centers_idoc-cost_centre ASSIGNING FIELD-SYMBOL(<ls_cost_centre>).
            <ls_cost_centre>-remote_external_object_id = 
            'CODE_OF_LOCATION;CODE_OF_DIVISION'.
    ENDLOOP.
  ENDMETHOD.

Code 2. Replication of additional parameters into field costCenterExternalObjectId

Replication of field costCenterExternalObjectId itself is enabled in SAP CPI in package ERPtoSuccessFactorsEmployeeCentralCostCenter in Externalized Parameter USE_EXTERNAL_COST_CENTER.

When replicated to Employee Central, the parameters can be used to assign Cost Center to other Generic Objects (in our case cust_Location), following the example of Code 1.

Conclusion

Extension of basic IDoc type ODTF_CCTR01 for replication of additional fields for Cost Centers is not advisable because the standard CPI package is not extendable.

As an alternative, additional parameters of Cost Centers can be replicated from ERP to EC with standard fields and used in Business Rules for assignment to other Generic Objects.

Reference list

  1. Latyshenko, V.V., 2020. The Core Hybrid integration model on the example of Cost Centers. SAPinsider, [online]. Available at https://www.sapinsideronline.com/wp-content/uploads/2020/12/The-Core-Hybrid-Integration-Model-on-the-Example-of-Cost-Centers.pdf (Accessed: 23 February 2021).
  2. Replicating Cost Centers from SAP ERP to Employee Central Using SAP Cloud Platform Integration as the Middleware. Document Version 2H 2020 – 2020‑10‑16. Available at https://help.sap.com/doc/6e943d18c1f347b88e91b1e605d502e2/2011/en-US/SF_ERP_EC_CC_HCI_en-US.pdf  (Accessed: 23 February 2021).
  3. Replicating Employee Master Data and Organizational Assignments from Employee Central to SAP ERP HCM. Document Version 2H 2020 – 2020-11-20. Available at https://help.sap.com/doc/435c6837038d4eb4b1a39947411d5a3e/2011/en-US/SF_EC_ERP_EE_Data_Org_Assignm_HCI_en-US.pdf (Accessed: 23 February 2021).


Assigned tags

      Be the first to leave a comment
      You must be Logged on to comment or reply to a post.