Skip to Content

HANA xsodata on calculation view using keys generate local returns "resource not found"

Oct 18, 2017 at 03:11 AM


avatar image

Dear experts,

with HANA XSC, I created an odata services on top of a calculation view using "keys generate local"

service {

"PROJ.model::CV_PROJDETAIL" as "CV_ProjectDetail" keys generate local "GENERATED_ID" aggregates always;

} annotations { enable OData4SAP; }

where there are three dimensions "p_name", "c_name", "proj_phase"

and one measure "cr_number" defined in the calculation view

and by accessing

GET /odata/odata.xsodata/CV_ProjectDetail/?$select=c_name,cr_number&$format=json

I get something like


  {"__metadata": {"type":"odata.CV_ProjectDetailType"



  {"__metadata": {"type":"odata.CV_ProjectDetailType"




,which is fine.

However, when I follow the metadata and try to

GET /odata/odata.xsodata/CV_ProjectDetail('543859892167869371')

I got a "RESOURCE NOT FOUND" error.

Is it normal? I would expect it to return the same result similar to


Best Regards


10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

1 Answer

Florian Pfeffer
Oct 23, 2017 at 05:28 AM

Yes, the behavior is normal, because the key is only valid for a single session (one OData call). The generated key is only there to fulfill the requirement that the OData result sets contain key. But no navigation etc. is possible with that keys. Check the documentation here.


Show 3 Share
10 |10000 characters needed characters left characters exceeded

HI Florian,

Thanks for the answer.

But it is strange that how session is defined here, one call per session ( although of course odata access is stateless in this regard).

The reason behind this question is the requirement of Fiori Element application which work properly with the odata services generated by the SAP NW gateway since the generated ID works throughout the entire logon session and can be used to reference the entity.

Do you know whether there is any plan to fill this function gap?

Best Regards



As I am no SAP employee and have no "direct" wire to that specific development area, I do not know if there is a plan to change something here.

Do you have the option to reuse an existing field or a combination of existing fields as key or to generate a constant key in a kind of "consumption calculation view"?


Hi Florian,

To provide some further background of the issue. In fact, I do have technical keys in the model. But due to the analytical nature of the fiori element application, this key field is not necessarily in the "select" option of the odata access. And in that case, no "ID" is returned from the odata service, which leads to endless access to the odata service from the Fiori element application. Use "keys generate local" is a workaround that guarantees an "ID" output, but due to the issue I mentioned in the question itself, it now seems not to be a working workaround, either.

Best Regards