简体   繁体   中英

"404 - Resource not found" when query OData v2 with empty key field

I have an SAP CDS View exposed via Gateway and hosted on APIM. This CDS has CRUD operations enabled using @ObjectModel annotations.

One of the key fields from the CDS (SAP table) can be empty as per business process, but when I try to query for this full key via APIM service (with the empty property) I receive 404 - Resource not found:

来自 APIM 的查询

The same query works fine inside SAP Gateway:

直接来自 SAP Gateway 的相同查询

What should I do in order to APIM understand that this key field can receive empty (or null?) values?

It is interesting to see this from the APIM service and gateway query, the result is different given the same query parameter, the only explanation to me is that there is a conversion at ABAP side and this cause no result can be loaded. Can you enable gateway trace at ABAP side to check the exact request when ABAP tries to query data when you use APIM client? Use transaction /IWNFD/TRACES to see the traces for your user at ABAP side.

Regards, Derek

Thanks for the answers!

We have found out that it might be an APIM mapping issue because when we set an empty key on the path (charg='') we receive a 404 without even reaching SAP Gateway:

来自 APIM 的状态为 404 的消息

But when we set this same parameter with a blank / space (charg=' '), it works fine and it finds the entry on S4 table:

来自 SAP 的状态为 200 的消息

How do I know it didn't reach S4? First, because the trace doesn't catch anything and second because the 404 message is differente when it comes from S4:

来自 SAP 的状态为 404 的消息

Thank you all!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM