Professional Documents
Culture Documents
Odata Services
Odata Services
display by client applications.The client can be web browser, or SAPUI5 application or HTML5 application
or any other application which supports OData.
OData services - Use an ODATA service that exposes a data end point in SAP HANA
In XS advanced, you can create OData services that use either OData version 2.0 or OData version 4.0.
OData version 2.0 is the basis for the XSODATA service infrastructure. Among other things, OData version
4.0 extends the query filters available, for example, $select and $expand.
XS advanced supports the SAP Cloud application programming model, which is now the recommended
model for new applications that make use of OData services. This programming model provides both Java
and JavaScript APIs that enable the easy use and integration of either OData v 2.0 or v 4.0 services.
o Java applications
In XS advanced, CDS-OData is currently available for use with Java and OData versions 2 and 4.
For JavaScript and Node.js applications in XS advanced, you can define an XS OData service using
OData version 2.0, for example, myOdataV2Service.xsodata. However, since there are no plans
to extend or improve the underlying XSOData infrastructure, and for the sake of future
compatibility, it is recommended to use the new SAP Cloud application programming model for
ODATA services.
Exposing a Database Table
1. Create the project structure (as shown in the example above) in your local system.
Sample Code
service {
"mytable" as "MyEntitySet";
5. Call your service from the client UI, for example, a Web browser:
You can call your OData service with: the following URI
http://<myServer>:<port>/odata/services/<myService>.xsodata
You can requests the metadata of the OData service using the following URI
http://<myServer>:<port>/odata/services/<myService>.xsodata/
$metadata