Human Capital Management Blogs by Members
Gain valuable knowledge and tips on SAP SuccessFactors HCM suite and human capital management market from member blog posts. Share your insights with a post of your own.
cancel
Showing results for 
Search instead for 
Did you mean: 
Latyshenko2
Active Participant
8,457
This article came into being because there are no open source information on how to transfer Cost Centers linked to any other objects except for Legal Entity and Controlling Area. Yet in SAP CO, there is entire hierarchy of Cost Centers with the purpose to make the selection of Cost Centers more user-friendly. So why not transfer the part of this hierarchy to Employee Central and make the selection of Cost Centers to be more user-friendly there as well?

Introduction


Program ODTF_REPL_CC is used for the replication of Cost Centers from SAP ERP Controlling to Employee Central, which includes the following data: the unique code of Cost Center (field externalCode), the short code of Cost Center (field costCenterExternalObjectId), Start Date, Status, Name, Description, Legal Entity (aka Company Code) and Cost Center Manager.[1]

The program uses IDoc ODTF_CCTR built on the basic type ODTF_CCTR01.

In this article, we will demonstrate the means of transferring Cost Centers and their relationships with the additional Generic and Foundation objects; for example, Business Unit, Location, Job Function or Division.

The reader will know the alternative to the extension of the basic type ODTF_CCTR01.

General Info


Let us assume that together with Cost Centers, it is required to transfer their relationships with the Business Unit and the Location in order to use these relationships in the Field Criteria for the restriction of the list of Cost Centers available for selection in Departments, Positions, and HRIS element ‘Job Information.’

In application SAP Cloud Integration, the standard package ERPtoSuccessFactorsEmployeeCentralCostCenter does not see the extension of the basic type ODTF_CCTR01; therefore, the standard fields should be used for the transferring of the additional relationships:

  • externalCode, which is the unique code of Cost Center

  • costCenterExternalObjectId, which is the short code of Cost Center


Field externalCode


Let us assume that the codes of Cost Centers are meaningful and the fifth character of the code corresponds to the Business Unit. For example, Cost Centers ‘ABCD1234567890’ and ‘ABCD987654321’ belong to Business Unit ‘CORP’ because the fifth character in their codes is equal to 1 and 9, respectively. We can embed this logic into the definition of Business Unit with use of the custom one-to-many composite child object. In Picture 1, this child object is marked in yellow. The code of its definition is cust_FifthCharOfCostCenterCode.


Picture 1. Custom one-to-many composite child object cust_FifthCharOfCostCenterCode used for the evaluation of Business Unit for Cost Centers


Programming Code 1 demonstrates the body of the On-Save Business Rule that evaluates the Business Unit based on the externalCode of object CostCenter. It is the Evaluate-Purposed MDF rule executed on the Save Event of MDF object CostCenter, to be precise.

The linkage of Cost Centers to other Generic and Foundation objects is performed in the similar way.

Programming Code 1. The MDF Business Rule linking Cost Centers to their Business Unit
rule() 
{
if(true)
{
CostCenter.cust_toBusinessUnit = lookup("cust_FifthCharOfCostCenterCode","parent","",
["externalCode","==",substring(text:CostCenter.externalCode,start:"5",length:"1"),"",""]);
}
}

 

Field costCenterExternalObjectId


Field costCenterExternalObjectId has narrow application: it can be used for the replication of Employee Data from Employee Central to SAP HCM provided that:

  1. The use of the field is enables in cluster VC_ECPAO_QRY_CFG ‘Settings for Employee Master Data and Organizational Assignment Query’

  2. The PA/PD integration in SAP HCM is deactivated

  3. Field cost-center of HRIS element ‘Job information’ is replicated directly to field KOSTL of infotype ‘Organizational Assignment’ in SAP HCM


However, there are many ways to evaluate the Cost Center based on field externalCode for the replication of data to infotype ‘Organizational Assignment’. Therefore, as a rule, there is no need to use field costCenterExternalObjectId for its intended purpose.

Let us assume that field costCenterExternalObjectId is not required for the replication of Cost Centers to infotype ‘Organizational Assignment,’ then we can use this field for the transferring of additional relationships of Cost Centers. The field is 40 characters long, which is enough for all parent objects of Cost Centers.

Programming Code 2 demonstrates the BAdI implementation ODTF_CO_REPL_IDOC_COST_CENTERS that fills field costCenterExternalObjectId with the codes of Location and Business Unit.

Programming Code 2. An example of BAdI implementation ODTF_CO_REPL_IDOC_COST_CENTERS
  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_BUSINESS_UNIT'. "Insert your code here
ENDLOOP.
ENDMETHOD.

The replication of costCenterExternalObjectId should be turned on in application SAP Cloud Integration in package ERPtoSuccessFactorsEmployeeCentralCostCenter in iFlow SAPToSFSFCostCenterReplication in Externalized Parameter USE_EXTERNAL_COST_CENTER.

The linkage of Cost Centers to the Generic and the Foundation objects themselves is performed as that was already described in Programming Code 1.

Conclusion


Cost Centers can be automatically linked to additional objects using BAdI implementation ODTF_CO_REPL_IDOC_COST_CENTERS and MDF Business Rules of object CostCenter.

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... (Accessed: 17 April 2022).

  2. Replicating Cost Centers from SAP ERP to Employee Central Using SAP Cloud Integration as the Middleware. Document Version: 1H 2022 – 2022-04-14. Available at https://help.sap.com/doc/6e943d18c1f347b88e91b1e605d502e2/latest/en-US/SF_ERP_EC_CC_HCI_en-US.pdf  (Accessed: 17 April 2022).

  3. Replicating Employee Master Data and Organizational Assignments from Employee Central to SAP ERP HCM. Document Version: 1H 2022 – 2022-04-14. Available at https://help.sap.com/doc/435c6837038d4eb4b1a39947411d5a3e/latest/en-US/SF_EC_ERP_EE_Data_Org_Assignm... (Accessed: 17 April 2022).





[1] If there is a choice of transferring the Cost Centers either from SAP ERP Controlling or from SAP HCM, then the latter is more preferable in order to ensure the same list of Cost Centers in SAP HCM and Employee Central


 

Russia

Author: Vladimir Latyshenko
Labels in this area