2

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.

Boghyon Hoffmann
  • 17,103
  • 12
  • 72
  • 170
Assaf
  • 63
  • 4
  • 11

2 Answers2

1

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

sepo
  • 394
  • 1
  • 8
  • Hey, all OData configuration created in segw, I didn't write any code. Its indeed the case, I don't return anything but in our specific business logic it can happen. Is there any good solution for this?Or I need to return some dummy value so the OData service will work? How do I know which version of OData am I using? Thank you very much for you help. – Assaf Aug 23 '20 at 05:06
0

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

SuShuang
  • 190
  • 6