OData Source
The OData Source tool is used to consume data from an Open Data Protocol (OData) service.
Currently, this tool 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 Neptune DXP - SAP Edition’s Cockpit to view OData management editor.
Click the Add button to open the Create OData Source pane.
Type in a name for the new OData Source, and click Create OData Source.
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.
-
Set OData Destination, select 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
After defining the OData service, set it as the Model Source for your shell object.