Felipe Martin
Felipe Martin

Reputation: 13

"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:

Query from APIM

The same query works fine inside SAP Gateway:

Same Query directly from SAP Gateway

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

Upvotes: 1

Views: 3970

Answers (2)

Felipe Martin
Felipe Martin

Reputation: 13

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:

Message from APIM with status 404

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

Message from SAP with status 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:

Message from SAP with status 404

Thank you all!

Upvotes: 0

wanderlandderek
wanderlandderek

Reputation: 396

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

Upvotes: 0

Related Questions