on 2023 Aug 07 11:37 AM
Hello Community,
I created an OData V4 Service to read data with RAP (CDS Views) based on a SAP Standard Table BNKA.
In the metadata any string are stated as Nullable="false".
For non key fields I would expect that fields can be null.
Can this be influenced via cds?
With Odata V2 the nullable property is optional and thus not mentioned when publishing the same service.
However i did not find the default value for the field if it is not declared.
What is the default value for nullable if not provided in OData V2?
Request clarification before answering.
Perhaps you will need to create an incident for the RAP tools. I don't work in that area so I don't know of another option.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello Tudor,
I found this attribute in the cds annotation syntax ABAP CDS - Framework-Specific Annotation Syntax - ABAP Keyword Documentation (sap.com)
But as per my understanding it is only available in S/4 Cloud.
As I have an OnPrem System available i get an error when trying it.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello Tudor,
Thank you very much sharing this. I will try this out.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
(This is a solution obtained via support message to SAP.)
You must declare a separate field that references the original one via a dedicated annotation:
@Semantics.nullValueIndicatorFor: 'OriginalField'
cast ('X' as boole_d) as NullValIndicator
As per my tests in S4H Cloud 2023, once you this:
1) OriginalField will no longer have "Nullable"="false" in the metadata of a generated V4 service;
2) The NullValIndicator will NOT appear in the service metadata.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Philipp,
Have you found an answer for this? I am also curious how to turn properties into Nullable so I can avoid sending them on the body payload.
Cheers.
Alejandro.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
The default for the CSDL XML Nullable facet is true for both OData V2 and V4.
As to whether that indicates a problem with the generation of either the V2 and V4 models you are working with, I can't comment as I don't know the origin of those XML files. If these are both machine-generated from the same input, then one of them is wrong since they aren't consistent.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
34 | |
21 | |
14 | |
8 | |
5 | |
4 | |
4 | |
4 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.