cancel
Showing results for 
Search instead for 
Did you mean: 

Resource not found for segment ''.

dave_price
Participant
0 Kudos

Hello, getting Resource not found for segment ''. when we run sap/opu/odata/SAP/SRA004_SRV/Travels('2000000155').

For some reason, this GET_ENTITY call works fine in Fiori itself, but when testing the call from gateway client or browser we get that error or sometimes Resource not found for segment 'Travel'.

Tried clearing cache and loading metadata, but that didn't help.

sap/opu/odata/SAP/SRA004_SRV/Travels comes back 200, so it can see the resource.


This also happens in our Z extension of the project, and for any new GET_ENTITY we make in that project.


Any ideas?

Accepted Solutions (1)

Accepted Solutions (1)

dave_price
Participant

OK, it turned out to be something fairly obvious -- we were calling this as a Read (GET_ENTITY) when only Query (GET_ENTITYSET) was set up (this was not totally obvious, because none of this was implemented in SEGW, it's all custom methods).  Somehow I got the impression from the web side that the Travel app was calling a Read but now I'm pretty sure they are only doing the Query.  Apparently within these non-SEGW implementations, sometimes even the generic READ method to find the correct entity READ method doesn't get called, let alone the actual READ entity method in the DPC_EXT class.

So, at least I learned that the "resource not found" error can result from SAP looking for methods that are not implemented (as opposed to returning the "not implemented" error from within the method itself).

Leaving this here in case it helps someone else!

Answers (3)

Answers (3)

dave_price
Participant
0 Kudos

Some further info: GET_ENTITY does not work, and neither does DELETE or GET_ENTITYSET, but the POST-based CREATE_DEEP_ENTITY does work (including the UPDATE functionality built into it).  Remember, this is all in SRA004, so there's no custom code.

The same is true for our Z version (ZRA004), where we added an Advances entity to Travels and called our custom RFC -- only the POSTs work, not the GETs or DELETEs.

And again, they work when our web guys call it from Fiori, just not from a Gateway client session or from browser directly.  This most okay for the SRA004 but obviously it's hard to develop our ZRA004 that way.

Also, weirdly, it sometimes actually runs the RFC (we know because it hits a debug point) so it's like the error is happening when it sends the output from the redefined method.  But then other times it doesn't run the RFC, for the same call a few minutes later.  Seems like some cache craziness, but doing the cache results and metadata loads didn't accomplish anything.

If no one else has run into this, I guess I might have to just debug the whole SAP stack and see where it's losing its marbles (which is a little tough because there's a one-minute timeout).  I did see a note for a similar error with SRA016 so I might try looking at that code first.

kammaje_cis
Active Contributor
0 Kudos

Dave,

In method GET_ENTITY if it does not find any relevant data, how are populating the return structure? I guess you have to send the key atleast back.

What I mean is

When you call sap/opu/odata/SAP/SRA004_SRV/Travels('2000000155')

If the key 2000000155 has valid values to be returned, then you will get the data.

But if you call

sap/opu/odata/SAP/SRA004_SRV/Travels('12345678')

You would get 'Resource not found for segment 'Travel'.

Regards

Krishna

dave_price
Participant
0 Kudos

Thanks Krishna, it is not a data issue, the same call works from Fiori, but not from gateway client or browser.

agentry_src
Active Contributor
0 Kudos

Hi Dave,

This may be simplistic, but your Travels is working, but Travel is not?

Is this a typo in your Discussion or in your gateway script?

Regards, Mike

SAP Technology RIG

dave_price
Participant
0 Kudos

Thanks Michael, Travels is the correct name, and it does not work from Gateway/browser but does work from Fiori, and it sometimes returns an error saying Travel, and sometimes an error with blank resource.