Skip to Content

XSOData Post return ID

Hi Colleagues,

I've created a xsodata service, and since I'm using a sequence to control the primary key, I've created a procedure to insert the information, calling the sequence.NEXTVAL when doing the insert.

In the header of the procedure I have two parameters (one IN and one OUT), The first parameter (IN) is the row itself, with the information that I need to insert, and the other parameter (OUT) is the error table, to get possible error messages.

Another remark is that, since when doing the post I need to inform all fields, I always perform the post setting ZERO in the ID.

The question is, can I somehow, receive the ID of the record inserted as the result/return of the post?

One idea was to set the ID in the row parameter, but since the row parameter is IN, I cannot modify it...

Thanks and regards,

Roberto Falk

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

2 Answers

  • Best Answer
    Posted on Aug 05, 2014 at 09:52 PM

    If you want to update the ID and have it returned through the ODATA Response, you should use XSJS exits and not SQLScript Procedure exits.

    Add a comment
    10|10000 characters needed characters exceeded

    • Hi Thomas,

      in fact, we have INOUT parameters, but just scalar parameters are supported. Table types, which is the case here, is not allowed.

      Funny, I'm a local HANA instructor here and I've always taught this (INOUT parameters) without really test it / use it. Now I had to test it, for the first time 😊.

      Thanks again for your help.

      Roberto Falk

  • Posted on Apr 12, 2015 at 09:10 AM

    Hi Roberto and Thomas,

    I face the same issue when using a stored procedure with hdbsequences to create new entries via my XSODATA service using a HTTP POST. I expect the new created ID in the result, but I only get the ID that I had to provide to make the input valid. I'm using the HCP Trial which is currently on HANA Any suggestions / solutions?

    Best regards


    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member Roberto Falk


      Can you post the sample code of how you did this ?

      I have the same situation.

      - POST over XS ODATA and processing in stored procedure.

      - IN & OUT defined but OUT is defined as error table.

      How can I return the newly created ID to the XS ODATA return without setting it in the error tab (which generated a 400 return).

      This post has tought me to use XSJS exit but i'm not sure how to use this.

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.