Symptom
purgeType incremental is not working for FOCostCenter. You have CostCenter to Legal Entity association. You have to link association through integration. But when you are sending new association through OData upsert, it's deleting old association. Import and Export data is working as expected.
Environment
SAP SuccessFactors Integration
Reproducing the Issue
Below sample payload:
[
{
"__metadata": {
"uri": "FOCostCenter(externalCode='ABC1', startDate=datetime'2023-04-11T00:00:00')"
},
"externalCode": "ABC1",
"startDate": "/Date(1681171200000)/",
"name": "NAME",
"cust_toLegalEntity": [
{
"__metadata": {
"uri": "FOCompany(externalCode='1234', startDate=datetime'2023-04-11T00:00:00')"
}
}
]
}
]
Cause
Root cause is when updating EC2MDF entity, COEC2MDFEditProcessor.beforeSave (editContext, resolvedInputs) will be invoked.
Before invoking this method, 'resolvedInputs' contains 2 record, one is loaded from DB, another is valid-when from the payload. But after calling the method, only one record is remaining.
Resolution
A workaround to fulfill your requirement is to add one property such as 'externalCode' under association metadata like following payload.
Please refer below:
[
{
"__metadata": {
"uri": "FOCostCenter(externalCode='ABC1', startDate=datetime'2023-04-11T00:00:00')"
},
"externalCode": "ABC1",
"startDate": "/Date(1681171200000)/",
"name": "NAME",
"cust_toLegalEntity": [
{
"__metadata": {
"uri": "FOCompany(externalCode='1234', startDate=datetime'2023-04-11T00:00:00')"
},
"externalCode": "1234"
}
]
}
]
See Also
purgeType incremental, purgeType, incremental, EC2MDF, resolvedInputs
Keywords
KBA , LOD-SF-INT-ODATA , OData API Framework , Problem