on 2021 Mar 04 5:10 PM
Hi Experts,
I have a CDS View which is EXA (External API) and i made communication setup for that CDS View.
After that i have tried to query it using postman. Got the below error.
Error:
In the context of Data Services an unknown internal server error occurred
Note: CDS View contains From date , todate parameters. I have the same kind of CDS view which has the same fields and Parameters also used for communication scenario.
$metadata loaded successfully.
But tried with the CDS view which does not have Parameters its works.
Analysis:
After 2102, we have some Define parameter option in Custom CDS Views App . In Datasources tab we have Parameter icon i clicked it. its opened. But its assigned properly.
Url: https://myxxxx-api.s4hana.ondemand.com/sap/opu/odata/sap/YY1_XYZ_CDS/YY1_XYZ(P_FromPostingDate=datetime'2021-02-01T00:00',P_ToPostingDate=datetime'2021-02-02T00:00')/Results
Please suggest if you have any idea.
Thanks,
Lingaraj
Request clarification before answering.
Hi Lingaraj,
Can you check the metadata for your parameter and confirm the type is like Edm.DateTime, for example. If it is not, your datetime'...' statement will not work.
<Property Name="SalesOrderDate" Type="Edm.DateTime" Precision="0" sap:aggregation-role="dimension" sap:display-format="Date" sap:required-in-filter="false" sap:label="Document Date"/>
Another way to do it is to add the posting date to your list of elements and use the filtering native to OData.
For example, I have a custom CDS view with SalesOrderDate as an added element from the datasource
and I use the filtering like this:
{{url}}/sap/opu/odata/sap/YY1_Z_SALES_ORDER_EXTRACT_CDS/YY1_Z_SALES_ORDER_EXTRACT?$filter=SalesOrderDate gt datetime'2020-05-31T00:00:00'
in your case you could use a combination of filtering including lt and gt (less than and greater than).
Thank you,
Jerry
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi
I noticed, the URL you provided had the date format wrong, it should be the following and I have highlighted what was missing in your query.
https://myxxxx-api.s4hana.ondemand.com/sap/opu/odata/sap/YY1_XYZ_CDS/YY1_XYZ(P_FromPostingDate=datetime'2021-02-01T00:00:00',P_ToPostingDate=datetime'2021-02-02T00:00:00')/Results
Jerry have provided some vital information that should have already helped you. If you feel this helped you, please close the thread by marking as the best answer.
Thank you!
Amith Nair
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
119 | |
8 | |
7 | |
5 | |
4 | |
4 | |
3 | |
3 | |
3 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.