SAP NetWeaver Gateway and OData Locate this document in the navigation structure

 

By exposing SAP Business Suite functionality as REST-based OData (Open Data Protocol) services, SAP NetWeaver Gateway enables SAP applications to share data with a wide range of devices, technologies, and platforms in a way that is easy to understand and consume.

Using REST services provides the following advantages:

  • Human readable results; you can use your browser to see what data you will get.

  • Stateless apps.

  • One piece of information probably leads to other, related pieces of information.

  • Uses the standard GET, PUT, POST, and DELETE. If you know where to GET data, you know where to PUT it, and you can use the same format.

  • Widely used, for example, by Twitter, Twilio, Amazon, Facebook, eBay, YouTube, Yahoo!

What is OData and Why Do we Use It?

OData was initiated by Microsoft to attempt to provide a standard for platform-agnostic interoperability.

OData is a web protocol for querying and updating data, applying and building on web technologies such as HTTP, Atom Publishing Protocol (AtomPub) and JSON (JavaScript Object Notation) to provide access to information from a variety of applications. It is easy to understand and extensible, and provides consumers with a predictable interface for querying a variety of data sources.

AtomPub is the de facto standard for treating groups of similar information snippets as it is simple, extensible, and allows anything textual in its content. However, as so much textual enterprise data is structured, there is also a requirement to express what structure to expect in a certain kind of information snippet. As these snippets can come in large quantities, they must be trimmed down to manageable chunks, sorted according to ad-hoc user preferences, and the result set must be stepped through page by page.

OData provides all of the above as well as additional features, such as feed customization that allows mapping part of the structured content into the standard Atom elements, and the ability to link data entities within an OData service (via “…related…” links) and beyond (via media link entries). This facilitates support of a wide range of clients with different capabilities:

  • Purely Atom, simply paging through data.

  • Hypermedia-driven, navigating through the data web.

  • Aware of query options, tailoring the OData services to their needs.

OData is also extensible, like the underlying AtomPub, and thus allows the addition of features that are required when building easy-to-use applications, both mobile and browser-based.

OData for SAP Applications

SAP NetWeaver Gateway uses OData for SAP applications, which contains SAP-specific metadata that helps the developer to consume SAP business data, such as descriptions of fields that can be retrieved from the SAP Data Dictionary. The following are examples of OData for SAP applications:

  • Human-readable, language-dependent labels for all Properties (required for building user interfaces).

  • Free-text search, within collections of similar entities, and across collections using OpenSearch. OpenSearch can use the Atom Syndication Format for its search results, so the OData entities that are returned by the search fit in, and OpenSearch can be integrated into AtomPub service documents via links with rel=”search”, per collection as well as on the top level. The OpenSearch description specifies the URL template to use for searching, and for collections it simply points to the OData entity set, using a custom query option with the name of “search”.

  • Semantic annotations, which are required for apps running on mobile devices to provide seamless integration into contacts, calendar, and telephony. The client needs to know which OData Properties contain a phone number, a part of a name or address, or something related to a calendar event.

  • Not all entities and entity sets will support the full spectrum of possible interactions defined by the uniform interface, so capability discovery will help clients avoiding requests that the server cannot fulfill. The metadata document will tell whether an entity set is searchable, which Properties may be used in filter expressions, and which Properties of an entity will always be managed by the server.

  • Most of the applications for “light-weight consumption” follow an interaction pattern called “view-inspect-act”, “alert-analyze-act”, or “explore & act”, meaning that you somehow navigate (or are led) to an entity that interests you, and then you have to choose what to do. The chosen action eventually results in changes to this entity, or entities related to it, but it may be tricky to express it in terms of an Update operation, so the available actions are advertised to the client as special atom links (with an optional embedded simplified “form” in case the action needs parameters) and the action is triggered by POSTing to the target URI of the link.

The following simplified diagram shows how Atom, OData, and OData for SAP applications fit together:

SAP NetWeaver Gateway and OData for SAP Applications (SAP NetWeaver Gateway and OData for SAP Applications)

For more information on OData, see www.odata.org.