Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 3

 An OData service exposes data stored in database tables or views as OData collections for analysis and

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.

 SAP Cloud application programming model

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.

 XS advanced application programming model:

o Java applications

In XS advanced, CDS-OData is currently available for use with Java and OData versions 2 and 4.

o JavaScript & Node.js

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

You can expose the database table db/src/mytable.hdcds as 'My Entity Set' as follows:

1. Create the project structure (as shown in the example above) in your local system.

2. Create the OData service definition file myservice.xsodata.

3. Expose the table as EntitySet in the xsodata file:

Sample Code
service {

"mytable" as "MyEntitySet";

4. Deploy your application with the client deployment tool.

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

You might also like