Symptom
When trying to import Alternative Cost Distribution (empCostDistribution API) for an employee using OData API – UPSERT,
API Response shows below error.
Error :
{
"key" : null, "status" : "ERROR", "editStatus" : null, "message" : "The total of the percentages for all cost centers must not be greater than 100%. with the index 0", "index" : 0, "httpCode" : 500, "inlineResults" : null
}
Environment
Successfactors HCM Suite
Reproducing the Issue
1. Upsert alternative cost item distribution via odata api
2. Encounter Error similar to symptom
Cause
Instead of deimiting old record for the new record, the system updates with all information including old record.
- You can enter up to 12 cost centers for one employment.
- The total percentage of all cost centers cannot be higher than 100 %.
- If the total percentage of all cost centers entered in the Alternative Cost Distribution portlet is less than 100 %, the remaining percentage is deducted from the cost center Foundation - Object that has been maintained for the employee.
- You can also add the cost center that has been maintained as Foundation Object for the employee in the Alternative Cost Distribution portlet.
Resolution
Use purgeType=record parameter
Follow below upsert request sample
1st : Update with 1 cost center
https://<API HOST URL>:443/odata/v2/upsert?$format=json&purgeType=record
Request Payload :
{"__metadata":
{"uri": "EmpCostDistribution"}
,"usersSysId":"'<insert userId'>",
"effectiveStartDate":"/Date(1565309520000 <insert in epoch time format>)/",
"items":
[
{
"__metadata":
{
"uri": "EmpCostDistributionItem
(
EmpCostDistribution_usersSysId='<insert userId>',
EmpCostDistribution_effectiveStartDate=datetime'2019-08-09T00:12:00.000Z <insert in UTC time format>'
)"
},
"costCenter": "<costCenterExternalCode>",
"percentage": "<insert percentage>"
}
]
}
See Also
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-ODATA , OData API Framework , LOD-SF-INT , Integrations , LOD-SF-INT-EC , Employee Central SFAPI & OData Entities , Problem