Quantcast
Channel: SCN : Discussion List - SAP HANA Developer Center
Viewing all articles
Browse latest Browse all 6412

XS OData service for table without primary key

$
0
0

Hi All,

 

I have the following table which needs to be exposed using an XS OData service. It does not have a primary key defined. We are using a Hana XSA (SP12) system Here is the CDS code for the table:

 

namespace db;
context dsf {
entity DSMD_SPACEBOUNDARY {  SPACEID : Integer64;  X : Double;  Y : Double;  ORDINAL : Integer64;  OPEN : String(1);
};

First I tried the following XS OData service definition:

 

service {  "db::dsf.DSMD_SPACEBOUNDARY" as "SpaceBoundaries"   keys( "SPACEID","ORDINAL" );
}

 

But when I call the $metadata URL, I got the following error message: "Keys cannot be specified for source as it is a table object."

 

Then I tried the following service definition:

 

service {  "db::dsf.DSMD_SPACEBOUNDARY" as "SpaceBoundaries"   key generate local "GenID";
}

 

And then I got the following error message: "Table object does not have a key. Add a primary key to the table or use a generated key."

 

What I'm doing wrong here? Is there no way to directly expose a table which does not have a primary key, using an xs odata service?

 

Thanks,

Isuru


Viewing all articles
Browse latest Browse all 6412

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>