SAP Knowledge Base Article - Public

2824006 - EmpCostDistribution/EmpCostDistributionItem upsert via OData API and possible errors

Symptom

When performing an UPSERT to EmpCostDistribution (Alternative Cost Distribution) using the OData API, the following error is returned:

Error: { "key": null, "status": "ERROR", "message": "The total of the percentages for all cost centers must not be greater than 100%. with the index 0", "index": 0, "httpCode": 500 }

Environment

  • SAP SuccessFactors HCM Suite
  • Employee Central

Reproducing the Issue

  1. Perform an UPSERT request to create/update EmpCostDistribution and EmpCostDistributionItem.
  2. The API response returns the error shown in the Symptom section.

Cause

The system is not delimiting the existing record before applying the new one.

As a result, the new UPSERT merges with the old data, causing the total allocation percentage to exceed 100%.

Important processing rules:

  • A maximum of 12 cost centers can be assigned per employment.
  • The sum of all percentages must not exceed 100%.
  • If the sum is less than 100%, the remaining percentage is automatically allocated to the employee’s Foundation Object cost center.
  • The Foundation Object cost center can also be included explicitly in the Alternative Cost Distribution portlet.

Resolution

Use the parameter: purgeType=record 

This ensures the system replaces the existing distribution records instead of merging them.

           

Sample UPSERT Request:

URL: https://<API_URL>/odata/v2/upsert?$format=json&purgeType=record

Payload:

{
  "__metadata": {
    "uri": "EmpCostDistribution"
  },
  "usersSysId": "<inform userId>",
  "effectiveStartDate": "/Date(<inform epochTime>)/",
  "items": [
    {
      "__metadata": {
        "uri": "EmpCostDistributionItem(EmpCostDistribution_usersSysId='<inform userId>',EmpCostDistribution_effectiveStartDate=datetime'<inform UTC date>')"
      },
      "costCenter": "<inform costCenterExternalCode>",
      "percentage": "<inform percentage>"
    }
  ]
}

See Also

SAP SuccessFactors Employee Central OData API: Reference Guide

Keywords

EmpCostDistributionItem , EmpCostDistribution , Alternative Cost Distribution, The total of the percentages for all cost centers must not be greater than 100%. with the index 0, purgeType=record, Odata API upsert , KBA , LOD-SF-INT-EC , Employee Central SFAPI & OData Entities , LOD-SF-EC-EMP , Employment Information (Employment Details) , Problem

Product

SAP SuccessFactors HCM Suite all versions