We are proud to share our inclusion in the 2024 Gartner Magic Quadrant for Data Integration Tools. We believe this recognition reflects the differentiated business outcomes CData delivers to our customers.
Get the Report →CData SAP Driver Deep Dive: Access SAP S/4HANA CDS Views as OData Services
In the previous article, we explained how to implement OData services using the SAP Gateway Service Builder for SAP S/4HANA. However, this approach requires internal implementation in ABAP each time, which can be cumbersome and complex.
In this article, we introduce a simpler method for publishing OData services using CDS Views. CDS (Core Data Services) Views are essentially SQL-like views that can be defined within SAP S/4HANA. These views offer a more efficient and flexible way to structure and retrieve data.
What sets CDS Views apart is their built-in functionality that allows them to be published directly as OData services. This eliminates the need for ABAP coding, simplifying the process and making it more accessible.
NOTE: We used SAP S/4HANA Private Cloud Edition for this article, but the principles apply to the Public Cloud Edition as well.
Creating the OData Service
The OData service we will create this time will retrieve a list of Bank data.

We will define a base CDS View and publish it as an OData service.

Start Fiori from the SAP Business Client
Let's start by creating the CDS View. CDS Views can be created using several approaches, but this time we will use the Fiori UI.
-
Start Fiori in the SAP Business Client.
-
Log in with any user.
-
From the search screen, navigate to "Custom CDS Views" and proceed with the steps.
Create a Custom CDS View
-
In the Custom CDS Views screen, click "Create" to begin creating the CDS View.
-
Specify a Label and Name, and select "External API" as the scenario to eventually publish it as an OData service.
-
Next, specify the Primary Data Source. In this example, we selected "I_Bank".
-
Follow the dialog to add settings, but for now, we will publish it with the default settings.
-
In the Elements tab, you can edit the items to be published. Add as needed.
-
Once the settings are complete, click the "Publish" button.
-
After publishing, click "Preview" to check the data that can be referenced in the CDS View.
Publish as an OData Service
Let's publish the created CDS View as an OData service.
-
Since we couldn't call "/IWFND/MAINT_SERVICE" in the Fiori UI, we will proceed with the work in the usual SAP Easy Access UI.
-
Navigate to "/IWFND/MAINT_SERVICE".
-
Click "Add Service".
-
Select any System Alias and click "Get Services". The name of the CDS View created earlier will be displayed.
-
Select the service and add it. Proceed with the default service registration properties.
-
This completes the publication as an OData service. It's much simpler compared to the previous blog article.
-
Next, let's verify if the API can be called using the SAP Gateway Client. You should see the resource "ZZ1_CDATA_TEST" in the service "ZZ1_CDATA_TEST_CDS".
-
Execute the request with "ZZ1_CDATA_TEST_CDS/ZZ1_CDATA_TEST" to successfully retrieve data such as BankCountry and BankName.
Connect to the Created OData Service from the CData Driver
Now that we've created our OData Service, let's connect it using the CData SAP NetWeaver Gateway Driver, similar to what we did in the previous OData services using the SAP Gateway Service Builder article.
For this example, we will use the ODBC version of the driver. However, the steps and principles are the same for other CData solutions such as JDBC, ADO.NET, or CData Sync.

- Download and install the driver from here.
- Once installed, launch the ODBC Data Source Administrator to configure the DSN (Data Source Name) for the CData SAP NetWeaver Gateway Driver by:
- On Windows: Search for "ODBC Data Source Administrator" in the Start menu, open the application, and select "CData ODBC Driver for SAP Gateway".
- On Mac: Open "Applications", go to "Utilities", and select "ODBC Manager", then choose "CData ODBC Driver for SAP Gateway".
- On Linux: Use the command line to launch the ODBC Data Source Administrator or use unixODBC if installed, then select "CData ODBC Driver for SAP Gateway".
- Enter the necessary information. Set the "Namespace" to "sap" and the "Service" to "CDATA_SAMPLE_SRV" for the OData service created.
- Test the connection. Once entered, the CDS View information will be displayed on the screen.
- Move to the Data Model tab to view the CDS View information displayed correctly. Preview the data to see the list displayed properly.
- You have now successfully exposed your created OData Service for the SAP S/4HANA CDS Views, and it is ready to be used.
Conclusion
Using CDS Views to publish OData services simplifies the process compared to traditional ABAP-based development in SAP S/4HANA. It allows you to quickly query and develop CDS Views via the OData service, reducing complexity and reliance on internal programming.
Try CData Drivers for Everything SAP
For seamless integration and easy connectivity to all your SAP data, try the CData SAP drivers today. Experience how easy it can be to connect and query your SAP S/4HANA data.