28.01.2013 Views

SAP HANA Developer Guide - Get a Free Blog

SAP HANA Developer Guide - Get a Free Blog

SAP HANA Developer Guide - Get a Free Blog

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

● Defined data to expose with the OData application, for example, at least the following:<br />

○ A database schema<br />

○ A database table<br />

1. In the shared project you are using for your OData application, use the Project Explorer view to locate the<br />

package where you want to create the new OData service definition.<br />

Note: The file containing the OData service definition must be placed in the root package of the OData<br />

application for which the service is intended.<br />

2. Create the file that will contain your OData service definition.<br />

In the Project Explorer view, right-click the folder where you want to create the new OData service-definition<br />

file and choose New File in the context-sensitive popup menu.<br />

3. Define the OData service.<br />

The OData service definition uses the OData Service Definition Language (OSDL), which includes a list of<br />

keywords that you specify in the OData service-definition file to enable important features.<br />

The following example shows a simple OData service definition exposing a simple table:<br />

service namespace "my.namespace" {<br />

"sample.odata:table.hdbtable" as "MyTable";<br />

}<br />

This service definition exposes a table defined in the file sample.odata:table.hdbtable and creates an<br />

EntitySet for this entity named MyTable. The specification of an alias is optional. If omitted, the default name<br />

of the EntitySet is the name of the repository object file, in this example, table.<br />

4. Place the valid OData service definition in the root package of the OData application to which it applies.<br />

5. Save, commit, and activate the OData service definition in the <strong>SAP</strong> <strong>HANA</strong> repository.<br />

Related Links<br />

OData Service Definitions [page 165]<br />

The OData service definition is the mechanism you use to define what data to expose with OData, how, and to<br />

whom. Data exposed as an OData collection is available for analysis and display by client applications, for<br />

example, a browser that uses functions provided by an OData client library running on the client system.<br />

8.1.7 OData Service Definition Language Syntax<br />

The OData Service Definition Language (OSDL) provides a set of keywords that enable you to set up an ODATA<br />

service definition file that specifies what data to expose, in what way, and to whom.<br />

The following list shows the syntax of the OData Service Definition Language (OSDL) in an EBNF-like format;<br />

conditions that apply for usage are listed after the table.<br />

definition :='service' [namespace] body<br />

namespace :='namespace' quotedstring<br />

quotedstring :=quote string quote<br />

string :=UTF8<br />

quote :='"'<br />

body :='{' content '}'<br />

content :=entry [content]<br />

entry :=( entity | association ) ';'<br />

entity :=object [entityset] [with] [keys] [navigates]<br />

[aggregates] [parameters]<br />

184<br />

P U B L I C<br />

© 2012 <strong>SAP</strong> AG. All rights reserved.<br />

<strong>SAP</strong> <strong>HANA</strong> <strong>Developer</strong> <strong>Guide</strong><br />

Defining Web-based Data Access

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!