Search code examples
odataabapsap-gateway

Resource not found for segment when calling GetEntity in OData service


I have function that exports a structure containing 4 numbers (int4). The function import is a flag.

I created a data model in SEGW for the function and created a GetEntity mapping

OData configuration in SEGW image

I encountered a problem that when I run the request with key = false AND all the numbers are 0, I get a "Resource not found for Segment"

Resource not found for segment picture

When I run the request with key = true and all the numbers are 0 it works fine. When I run the request with key = false and at least one of the numbers is not 0 it works fine.

I guess I can resolve it by exporting a dummy number with the value 1, but I'd like to know if there is a better way to solve it.


Solution

  • As there is no code extract of how you handle the get entity, I can’t be sure that this is the problem but: I would check what you return (er_entity) in case of a call with “false”. It seems you don’t return anything and the OData expects to read something upon a “false” call.

    Additionally, it would help to mention the version of OData you are using. There are 2 versions supported by SAP currently.

    Cheers, SePo