Skip to Content
0

XSOData Create or Update

Sep 25, 2017 at 10:09 AM

556

avatar image
Former Member

Hi Experts,

I'm developing a XSODATA service using HANA 1.0 SPS12.

This service exposes one principal CDS entity ('Project') and I need to create or update data entries for this entity from ABAP stack.

Typically, the entries should be created during the first call and updated during the following calls.

But the ABAP client is not aware of the right operation (CREATE/POST or UPDATE/PUT).

I have implemented first a XSJS service which receives only POST requests. This way, I was able to put the logic create/update on server side. Now, I would like to have the same behavior in XSODATA but I don't know how to achieve this.

I thought about calling a procedure during creation but is it really relevant for updating entries?

A kind of UPSERT statement for XSODATA and HANA 1.0 would be perfect...

What is recommended here?

Thank you,

Sophie

10 |10000 characters needed characters left characters exceeded
Former Member

Hello Sophie,

We are also stuck in same situation where not able to use Upsert operation in XSODATA.

We are integrating PO with Hybris marketing. Since create and update not possible in the same call we may need to do some complex logic in PO.

So can you please tell us what approach you made to solve this problem? and also give us the brief about the steps taken?

Thanks and Regards,

Sriram

0
* Please Login or Register to Answer, Follow or Comment.

2 Answers

G B Sep 25, 2017 at 01:05 PM
0

Hi Sophie

You can override the generic Odata POST/PUT/DELETE operations by using Odata modification exits that can be written in either XSJS/SQL Script. For the PUT operation, we will have to send a key i.e the ID to be updated. If it fits your usecase so that you can send in the ID and you are still ok to do an UPSERT, then you can do it via OData exits.

Share
10 |10000 characters needed characters left characters exceeded
avatar image
Former Member
Sep 25, 2017 at 10:37 AM
0

Hi Sophie,

In general, xsodata can do POST and PUT operation separately. There is no intelligence present to do upsert (either to insert or update ) operation.

To attain the same, the user should have some service to handle that logic.

  1. The one which you tried using xsjs service is one way to handle the logic
  2. If you don't want to write the logic in server side, I would suggest you to create a procedure in HANA which handles the logic to do upsert operation for POST call itself. Refer the following video by Thomas - oData Create/Update/Delete Support in SAP HANA SPS6

Regards,

Surya

Share
10 |10000 characters needed characters left characters exceeded