Assaf
Assaf

Reputation: 63

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.

Upvotes: 2

Views: 16195

Answers (2)

SuShuang
SuShuang

Reputation: 190

I was facing the same issue and the problem is - as SePo mentioned - that nothing is being returned in GetEntity method. To fix this go to transaction SE80, fins your odata class:

Find class

then in list of classes you will find the one you are interested in - it will have "GET_ENTITY" at the end of the method name. Just right click on that and click Redefine.

Redefine

Now you will find your method under redefinitions - double click on that class:

Redefinitions

The one last thing you need to do is to populate "er_entity" structure.

er_entity

That should do the trick :)

Upvotes: 0

sepo
sepo

Reputation: 404

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

Upvotes: 1

Related Questions