An OData service must have a key specification as a unique URL for each record must be generated. For table sources XSODATA uses the key specification of the table itself as the source of the OData key. Calculation views, on the other hand, have no key structure. You must either specify the key columns within the XSODATA document itself
service {
"sap.hana.democontent.epmNext.data::MD.BuyerView"
as "Buyer"
keys("Id");
}
Or use the KEYS GENERATE LOCAL option to have the framework generate a key for you (useful when you have aggregation):
service namespace "sap.hana.democontent.epmNext" {
"sap.hana.democontent.epmNext.models::SALESORDER_DYNAMIC_JOIN"
as "SalesByCountry" with ("COUNTRY", "TOTAL_SALES", "SALES", "SHARE_SALES")
keys generate local "ID"
aggregates always;
}