SapHanaTutorial.Com HOME     Learning-Materials Interview-Q&A Certifications Quiz Online-Courses Forum Jobs Trendz FAQs  
     Explore The World of Hana With Us     
About Us
Contact Us
 Apps
X
HANA App
>>>
Hadoop App
>>>
Tutorial App on SAP HANA
This app is an All-In-One package to provide everything to HANA Lovers.

It contains
1. Courses on SAP HANA - Basics, Modeling and Administration
2. Multiple Quizzes on Overview, Modelling, Architeture, and Administration
3. Most popular articles on SAP HANA
4. Series of Interview questions to brushup your HANA skills
Tutorial App on Hadoop
This app is an All-In-One package to provide everything to Hadoop Lovers.

It contains
1. Courses on Hadoop - Basics and Advanced
2. Multiple Quizzes on Basics, MapReduce and HDFS
3. Most popular articles on Hadoop
4. Series of Interview questions to brushup your skills
Apps
HANA App
Hadoop App
';
Search
Stay Connected
Search Topics
Topic Index
+
-
XSA Overview
+
-
XS Overview
+
-
Hello World Example
+
-
XS OData Service
+
-
HANA XSJS Service
+
-
Core Data Service
+
-
Others

SAP HANA OData Service

Introduction:

The articles Introduction to OData Service and OData Architecture explain the basics of OData.
In the article Introduction to SAP HANA XS, we also explained that SAP HANA XS can be used to expose data from Tables, Views and Modeling Views to UI layer.
In HANA XS, there are major 2 ways to expose data the data to clients – OData and XSJS. In this article we will talk about OData.
In this article we will explain
  • How OData service works in SAP HANA?
  • What is XSOData (OData file in HANA)?
  • SAP HANA OData Framework.

Note: For XSJS, read the article SAP HANA XSJS Service

OData Service in SAP HANA:

SAP HANA OData Service

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.

An OData service for SAP HANA XS is defined in a text file with the file suffix .xsodata, for example, OdataSrvDef.xsodata.

The XSODATA services are great because they provide a large amount of functionality with minimal amounts of development effort.


Important points on HANA OData Service (XSODATA):


  • SAP HANA XS currently supports OData version 2.0
  • OData defines operations on resources using RESTful HTTP commands (for example, GET, PUT, POST, and DELETE).
  • Data is transferred over HTTP using either the Atom (XML) or the JSON (JavaScript) format.
  • For modification operations, for example, CREATE, UPDATE, and DELETE, SAP HANA XS supports only the JSON format
(“content-type: application/json”)


XSOData Examples:

An OData service for SAP HANA XS is defined in a text file with the file suffix .xsodata
The file must contain at least the entry
service {
}

The following example shows how to include a reference to a table in an OData .
service {
"mySchema"."myTable" as "MyTable";
}

You can also expose Attribute, Analytic and Calculation view using XSOData.
Suppose there is a calculation view called “Sales” in a package “sap.hana”, then the service will be like:

service {
"sap.hana"::"Sales" as "Sales";
}

Read-only XSOData Service:

By default, all entity sets in an OData service are writeable, that is they can be modified with a CREATE, UPDATE, or DELETE requests.
However, you can prevent the execution of a modification request by setting the appropriate keyword (create, update, or delete) with the forbidden option in the OData service definition.

The following example of an OData service definition for SAP HANA XS shows how to prevent any modification to the table myTable that is exposed by the OData service.

service {
"mySchema"."myTable" as "MyTable"
create forbidden
update forbidden
delete forbidden;
}

Continue reading:



Support us by sharing this article.



Explore More
Close X
Close X

One thought on “SAP HANA OData Service

  1. Mahdi says:

    there are major 2 ways -> ‘there are 2 major ways’ is correct

Leave a Reply

Your email address will not be published. Required fields are marked *

Current day month ye@r *

 © 2017 : saphanatutorial.com, All rights reserved.  Privacy Policy