cancel
Showing results for 
Search instead for 
Did you mean: 

MB5B External API IN 2SL PUBLIC CLOUD

Kamar_Khan
Participant
0 Kudos

Hi Expert

We have a requirement to display the material stock based upon the date in 2SL Public Cloud, So we have used the one CDS ('I_MaterialStockTimeSeries'). which has a date parameter to display the value. It is working fine in custom CDS view ,but while expose that CDS into external API that is giving error due to parameter. when I removed the Parameter as follow the below screen-shot but I am not getting output based upon user input date. we are getting current date data only.

Thanks

Gourav bajaj

Accepted Solutions (0)

Answers (1)

Answers (1)

yogananda
Product and Topic Expert
Product and Topic Expert
0 Kudos

qkamar21

A:

The best way to solve this issue is to use an input parameter in the CDS view and then pass the date value from the API to the parameter. This way, the CDS view will always return the data for the date passed in the parameter.

Another option is to use an OData query option in the API call to pass the date value to the CDS view. The syntax for the query option is:

$filter=date_column eq datetime'YYYY-MM-DDTHH:MM:SS'

For example:

$filter=date_column eq datetime'2020-02-02T00:00:00'

This approach should work as long as the date column in the CDS view is a DateTime data type.

If neither of these approaches work, then you may need to write custom logic to filter the data in the CDS view based on the date value passed in the API call.