cancel
Showing results for 
Search instead for 
Did you mean: 

Problem with updating fields in organization unit using c4codataapi

prat2
Explorer
0 Kudos

Hi all,

I have a requirement to update Employee in Organisation unit in C4C.

I am using standard odata service (c4codataapi) for this purpose.

entity: OrganisationalUnitEmployeeAssignmentCollection

property that i am trying to update: JobID and EmployeeID

Property of the Fields

I am sending a PATCH request with the following path and with json data

/sap/c4c/odata/v1/c4codataapi/OrganisationalUnitEmployeeAssignmentCollection('00163E832F9B1EE9A3850019AE940236')

{
    "EmployeeID": "10000021"
}

I am getting an error , <message xml:lang="en">Change not possible; object does not exist</message>

Internal server Error : 500

When i do the GET for the same request , I get the Object.

Am i missing something?

Best regards,

Prat

View Entire Topic
leonardo_felini
Advisor
Advisor
0 Kudos

Hi Pratyush,

I made some tests in our internal system, and was able to reproduce the same error. In fact, it seems that it is not possible to change the employee ID from an object of the OrganisationalUnitEmployeeAssignment collection, as it is a key field. In this context, the "updatable" property that you mentioned means that the object can be removed in case of a DELETE request, rather than meaning it's value can be changed.

So the best approach for this would be to perform two operations. First send a DELETE request to the collection object ('00163E832F9B1EE9A3850019AE940236'), and then perform a POST operation with the required data (the new employee ID) to create a new entry in the collection.

Kind regards,

Leonardo

Support Consultant | SAP Product Support

Community:

SAP Business ByDesign: https://www.sap.com/community/topics/business-bydesign.html

SAP Cloud for Customer: https://www.sap.com/community/topics/cloud-for-customer.html

prat2
Explorer
0 Kudos

Thank you Leonarda for confirmation. I was doing the same thinking as a work around.

Regards

Prat