odatahanahana-xs

return updated object in xsodata update operation exit


I was wondering if it was possible in SAP HANA to update an entity with an xsjslib file and return the updated object. Currently, when updating an entry, it returns '204 - No Content'.

Sample of xsodata

"DEMO.VIEWS::myEntity" as "MyEntity" keys("ID")
create using "DEMO.SCRIPTS:createEntity.xsjslib::createEntry"
update using "DEMO.SCRIPTS:updateEntity.xsjslib::updateEntry"
delete using "DEMO.SCRIPTS:deleteEntity.xsjslib::deleteEntry"; 

Response

no content

Useful documentation

I've looked at the documentation SAP has on this and I don't seem to find anything related to updating.

SAP documentation

There is also a great tutorial which explains this for the create operation. This works but sadly not for the update operation.

Tutorial for create operation


Solution

  • An HTTP PUT (or HTTP PATCH) has no response (check this for instance here). SAP does not change that standardized behavior. So if you really need to get back the updated object (because for instance on backend side, some special logic changes properties not part of your PUT request), you have to do an additional GET request.