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.
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”.
Then perform a connection test. This should give a positive result, as shown here.
In SAP Web IDE, you can include the service in an SAP Fiori project by selecting New > OData Service from the context menu.
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.
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.
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.
Editor’s note: This post has been adapted from a section of the book Cloud Connector for SAP by Martin Koch and Siegfried Zeilinger.