OData Source

The OData Source component is used to consume data from an Open Data Protocol (OData) service.

Currently, this component supports the OData v2 protocol.

Open Data Protocol (OData) is a standardized protocol for creating and consuming data from OData server. oData builds on core protocols like HTTP and commonly accepted methodologies like REST. The result is a uniform way to expose full-featured data APIs.

OData source allows the user to publish and manipulate the resources identified by the endpoints (resource location).

Getting started with OData

Go to Connectivity → OData Source from Cockpit to view OData management editor.

odata main

Click the Add button to open the Create OData Source window.

Type in a name for the new OData Source, and click Create OData Source.

odata config

OData Source properties explanation:

General

Name: Name of oData source, it can be anything

Description: Brief description of the oData source and service used.

Connection

Enable Proxy: Allow cross-domain connectivity. When consuming oData services from sources which are external to your domain, Cross-Origin Resource Sharing (CORS) errors might occur in your app. While developing and testing, you may disable Security in your browser. In SAP BTP, please remember to setup the correct Destinations so CORS is avoided and your app is safe.

Service Url: Path to access OData service resources.

Username: Username for authenticating to OData source.

Password: Password for authenticating to OData source.

SAP Cloud Destination: When exporting an app to SAP BTP, SAP Cloud Destination field will be used instead of the regular URL field.

How to use OData in App Designer

Open your App in App Designer. Define the oData service by adding the oDataModelV2 object under the resources folder. This object is found in the sap.ui.model library.

odata appdesigner
  • Set oData Destination, choose the oData source from the list.

  • Set attribute defaultCountMode to “Inline”

  • Set attribute defaultBindingMode to “TwoWay”.

BindingModes

Different ways of binding OData services, and your choice will depend on the use case, the OData service, and the UI component.

  • One Time: One-time binding means from model to view once.

  • One Way: One-way binding means a binding from the model to the view; value changes in the model update all corresponding bindings and the view

  • Two Way: Two-way binding means a binding from the model to the view and from the view to the model; value changes in the model and in the view update all corresponding bindings and the view and model, respectively

odata bind

After defining the oData service, set it as the Model Source for your shell object.

odata bind2