Skip to Content

Default values in XSOData create operation

We are on HANA 1.0 SPS12.

We have a table (HANA CDS entity) with timestamp and user fields along with others. We are using procedure to create entries in the table. We use current_timestamp and session_user as default values for the time stamp and user fields within the procedure. Now the problem is when we pass values from UI the system expects us to pass dummy values for these fields. I tried also with the table type without the aforementioned fields but the situation remains the same. Is it possible to call the POST operation without mentioning these fields at all?

The error I am getting is "The serialized resource has an missing value for member 'CreatedAt'"

But works just fine if you pass dummy values.

I saw something similar for IDENTITY column being used in the blog https://blogs.sap.com/2015/03/06/odata-service-definition-xsodata-for-tables-with-an-identity-column/ but we would like to avoid using dummy variables in the POST call.

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • Best Answer
    Apr 10 at 06:18 PM

    XSODATA doesn't know about your default values within the procedure and will still validate and expect values. You either have to supply dummy values or use a view without these fields as the source entity in your XSODATA definition.

    Add comment
    10|10000 characters needed characters exceeded

    • >Because not having created by/changed by fields in the view is not an option

      Why not? You can have a specialized view just for the OData interface. You can still insert into the full table within the OData exit.

      >Would be really cool if it was not the case and the XSOData can check and validate against the procedure interface as opposed to the view.

      That is not going to happen.