Skip to Content
0

Default values in XSOData create operation

Apr 04 at 05:01 PM

46

avatar image

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.

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

1 Answer

Best Answer
Thomas Jung
Apr 10 at 06:18 PM
0

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.

Show 2 Share
10 |10000 characters needed characters left characters exceeded

Thanks Thomas

Because not having created by/changed by fields in the view is not an option I understand we will always have to use dummy values. Is this going to change or will stay the same? 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.

0

>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.

1