cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Error while trying to read data from xsodata with multiple input parameters

OmPrakashJha
Participant
0 Kudos
408

Hi All,

I have created an XSODATA service using a calculation view with multiple input parameters. Below is the code syntax.

service { "xxx_pal2::PAL2_INTRADAY_FORECAST" as "xyz" with ("LocationId", "ForecastDate", "StartTime", "EndTime", "ForecastValue" ) keys generate local "ProductId" parameters via entity "InputParams";}

When I try to preview data in browser. It throws error.

URL 1 : https://Port//Package/PAL2_INTRADAY_FORECAST.xsodata/xyz?$format=json

error:

{ "error": { "code": "", "message": { "lang": "en-US", "value": "Resource not found for the segment 'xyz' at position 0."}}}

URL 2:

https://Port//Package/PAL2_INTRADAY_FORECAST.xsodata/InputParams(P_SAPClient='100',P_DiagnosticId='0',P_SlotTimeFrame='120',P_DateFrom='0',P_DateTo='0',P_ForecastDateFrom=20210429,P_ForecastDateTo=20210429)/Results?$format=json

error:

{ "error": { "code": "", "message": { "lang": "en-US", "value": "Illegal query syntax."}}}


Could you please check if I am passing input parameter correctly? I have also attached metadata screenshot.

Accepted Solutions (0)

Answers (1)

Answers (1)

pfefferf
Active Contributor
0 Kudos

The 2nd URL has the right format, but I guess you get the error, because of how you pass the date parameters (P_DateFrom, P_DateTo, P_ForecastDateFrom, P_ForecastDateTo).

If the parameters are typed as strings you have to enclose it in single quotes, if they are real dates, you should pass it like following, for instance:

P_ForecastDateFrom=datetime'2021-05-19'
OmPrakashJha
Participant
0 Kudos

Hi Florian,

Thanks for your response.

Date parameters are defined as decimal in SAP standard view.It worked for me when I pass data with format (YYYYMMDD+m) in Date input parameters.

For example:- 20210429m

Issue is resolved now 🙂

Regards,

Om