Skip to main content

OData

What Is OData?

OData is an open standard for building and consuming RESTful APIs. It defines a query language to send and retrieve data via HTTP and to perform operations on data.

There are two widely used versions of the protocol: OData v2 and more extended and functional OData v4.

What OData Versions do You Support?

OData protocol versionSAP Cloud SDK V3
OData v2
OData v4
generate a client library yourself

You can always generate a type-safe OData client library based on API specifications available on the SAP Business Accelerator Hub or found elsewhere.

Why Using the SAP Cloud SDK for OData?

The SAP Cloud SDK simplifies the consumption of OData services by offering:

Type-Safe OData Client

  • We provide a type-safe OData client to build and execute OData requests
  • For many popular SAP OData services we ship pregenerated type-safe clients. In the SAP universe, they are called the Virtual Data Model or VDM. The most popular type-safe client module contains a collection of all OData services of SAP S/4HANA Cloud and SAP S/4HANA On-premise 2020.
  • We support both OData v2 and OData v4 protocols in the SAP Cloud SDK for Java.

Generic OData Client

We expose an advanced generic OData client that can be leveraged when the capabilities or flexibility of a type-safe client are not enough. Be careful and know what you're doing.

Code Generator

If you need a client for an OData service where we do not ship a pregenerated client. Use our code generator to convert its service definition into the type-safe Java client library. You can do it for any service either developed by yourself, provided by SAP, or other third parties. The SAP Business Accelerator Hub is where you'll find the specification for most of the SAP-published services.

  • Service definition usually comes in form of the .edmx file and contains metadata of OData service. The simplest way to obtain it, if you have access to the service, is navigating to the http(s)://<service-path>/$metadata endpoint. You can generate a client for any third-party service or a service that you've built on your own.
  • You can generate clients via our command-line interface (CLI) or Maven plugin.

Convenience Over The SAP Business Technology Platform

We simplify development process on the SAP BTP by providing convenient abstractions over:

You Are Extending an SAP Product or Service, Building a Middle-Ware, Publishing a Cloud App

  • Type-safe consumption of OData services. By consumption, we mean building and executing API calls against OData service with serialized request data and processing serialized responses. All in a type-safe way. Your code focuses on business logic and leaves lower-level tasks to the SAP Cloud SDK.
  • Converting OData API into a different flavor of REST API. You can use the SAP Cloud SDK for Java to build an app that converts your desired REST format to OData calls and vice versa. Such an app may serve as a proxy, integration adapter, service gateway, etc.
  • Serving as a layer to fetch data from and push data to OData services. Instead of building your query tool you can fetch the data with the SAP Cloud SDK and pass it on to your UX framework, analytics tool, data converter, etc. Reverse data flow will allow you to push new or modified data to the OData service for processing or persistence. In that manner, the SAP Cloud SDK can help you implement adapters for a hexagonal architecture.

Developing and Publishing OData Service

  • Use the SAP Cloud SDK to create a robust automated testing framework. You can create a type-safe client for your own OData service with our generator and scale your automated testing capabilities. This comes with the advantage of updating your client code with ease while your service grows and its metadata evolves.
  • Shipping your client module with the SAP Cloud SDK for Java. As a service developer, you're usually interested in an easy way for your customers to consume your service. That's exactly what the SAP Cloud SDK does. When your service is finished, you can generate an API client with the SAP Cloud SDK and release it to developers using your service. As an SAP service, you can contribute your API definition via our contribution process. Once accepted, your pregenerated type-safe client will be shipping as a Maven module of the SAP Cloud SDK.

Coding Convention and Inter-Operability

  • Making sure different teams in your organization coherently consume OData services. The SAP Cloud SDK will help you to save developers' time, ensure best coding practices, and knowledge sharing. Such an approach ensures you won't have duplication of work to save the same problem by different teams and guaranteed high levels of interoperability and integration.

Advanced Features and Custom Development

  • Using certain SAP Cloud SDK features for Custom OData service consumption or publishing. If the SAP Cloud SDK's features for OData consumption do not cover your use-case end-to-end, you can still benefit from our public utility and helper methods like OData expression builder, non-type safe request builders, and some others. Make sure you know what you're doing because the SAP Cloud SDK can't guarantee convenience and correctness in such a case.