How to Consume an OData Service from a Cloud System in SAP Web IDE

The use of OData services in a cloud system represents another common use case in SAP Web IDE.


There are two ways to create destinations for the consumption of OData services in SAP Web IDE. In the first section of this blog post, we show you how to create a destination in SAP BTP. The alternative is creating a destination in SAP Web IDE itself. This will be shown in the second section.


Create Destination in SAP BTP, Neo Environment Cockpit

You must also create a destination to consume an OData service. To do this, navigate to the Connectivity > Destinations area in the SAP BTP cockpit of the subaccount, as shown below. Click New Destination.


Destination Overview


Now maintain the properties of the destination as usual (see next figure). In Additional Properties, add WebIDEEnabled with the value “true” and WebIDEUsage with the value “odata_gen”.


Create HTTP Destination for Cloud API



Then perform a connection test. This should give a positive result, as shown here.


Connection Check


In SAP Web IDE, you can include the service in an SAP Fiori project by selecting New > OData Service from the context menu.


Add OData Service to SAPUI5 App


Now select the Service URL as the Source. Then you must select the previously created destination in the dropdown menu. You also have to specify the path of the OData service, as shown in the following figure. Afterward you must maintain the model, which is not discussed in detail here because it depends on your application.


Service Selection


If you’d like to learn more about OData services, we recommend the book SAP Gateway and OData by Carsten Bönnen, Volker Drees, André Fischer, Ludwig Heinz, and Karsten Strothmann.


Create Destination from SAP Web IDE

For some time now, developers have also been able to create a destination directly from the SAP Web IDE. To do this, they have to click the Create a New Data Source link in the dialog for adding a new OData service, as shown below. The link is then displayed in the dialog.


Create Destination inside SAP Web IDE


Afterward you can maintain all required attributes, like creation via the SAP BTP cockpit (see final figure). At this point, however, it isn’t necessary to maintain the Additional Properties.


Data Source Configuration


Editor’s note: This post has been adapted from a section of the book Cloud Connector for SAP by Martin Koch and Siegfried Zeilinger.


Cloud Connector for SAP
Cloud Connector for SAP

Establish quick and secure communication between your cloud and on-premise systems with SAP Connectivity service’s cloud connector! Set up and configure the cloud connector, from performing sizing to implementing connectivity APIs. Link on-premise SAP products to SAP BTP and its services, including SAP Business Application Studio, SAP Integration Suite’s Cloud Integration, and more. With information on creating secure connections, administering the cloud connector, and monitoring, this guide has everything you need!

Learn More

SAP PRESS is the world's leading SAP publisher, with books on ABAP, SAP S/4HANA, SAP CX, intelligent technologies, SAP Business Technology Platform, and more!