Introduction
In our previous post, we saw how to call REST API in SSIS. Now let’s learn how to read data from SAP S4 / HANA OData Service (i.e. S/4HANA). SAP HANA provides an OData REST API interface to access data in your application using HTTP Protocol. We will use the SSIS XML Source component to read SAP data and load it into the SQL Server Table in a few clicks.
Prerequisites
Before we perform the steps listed in this article, you will need to make sure the following prerequisites are met:- SSIS designer installed. Sometimes it is referred to as BIDS or SSDT (download it from the Microsoft site).
- Basic knowledge of SSIS package development using Microsoft SQL Server Integration Services.
- Make sure ZappySys SSIS PowerPack is installed (download it, if you haven't already).
- (Optional step). Read this article, if you are planning to deploy packages to a server and schedule their execution later.
About SAP HANA / OData REST API Service
You can expose your SAP Data using ODATA REST API Service. Here is a good article that shows how to expose data as an OData Service. For more information on the SAP OData Service feature check the SAP help page. If you are new to OData standard then read an article to learn more about it. If you need an XML-based OData Service then use the test URLs below:
|
1 2 3 4 5 |
https://services.odata.org/Northwind/Northwind.svc/ https://services.odata.org/Northwind/Northwind.svc/Customers https://services.odata.org/Northwind/Northwind.svc/Orders https://services.odata.org/Northwind/Northwind.svc/Invoices https://services.odata.org/Northwind/Northwind.svc/Products |
Now let’s look at how to read SAP Data in SSIS. At this point, we assume you have exposed your data as OData Endpoint.
Step-by-Step Instructions
Let’s look at the step-by-step approach to how to read SAP data using SSIS components. Then we will load SAP HANA data into SQL Server.
Read SAP HANA data using XML Source
First, let’s look at the steps on how to configure XML Source. We will read data from SAP S4 / HANA OData Service and then we will look at how to load data into SQL Server in the next section.
- Open an SSIS package.
- Drag Data Flow Task from SSIS Toolbox and double-click it to open it.
- From the SSIS Toolbox drag ZS XML Source onto the background of Data Flow (in the designer). Double-click it to open the XML Source configuration window.
- Change Data Format to OData. Selecting this option will take care of REST API pagination too.
- Enter your OData Service URL. Its format looks similar to the one shown below. Replace 3 parts with your own value (i.e. replace {MY-INSTANCE}, {MY-PROJECT}, {MY-TABLE}):
For example, if you are hosting SAP HANA in a cloud instance then your URL may look like this:1https://{MY-INSTANCE}/sap/opu/odata/sap/{MY-PROJECT}/{MY-TABLE}
1https://myXXXXXX-api.s4hana.ondemand.com/sap/opu/odata/sap/MyTestProject/PurchaseOrders - Check the Use Credentials checkbox and select the New ZS-HTTP Connection option.
- In HTTP Connection Manager select the Basic Authentication option and enter your SAP HANA UserID / Password.
- Let’s get back to the XML Source connector we created in the previous stage. Press the Select Filter button or directly type $.feed.entry[*] into the field as shown below:
- Click Preview to make sure you can see the records.
- Click OK to save the configuration and close the configuration window.
In the next section, we will configure the target to load SAP data into SQL Server using the ZappySys Upsert Destination Data Flow component.
Load SAP HANA data into SQL Server using Upsert Destination
ZappySys SSIS PowerPack makes it easy to load data from various sources such as REST, SOAP, JSON, XML, CSV or from other source into SQL Server, or PostgreSQL, or Amazon Redshift, or other targets. The Upsert Destination component allows you to automatically insert new records and update existing ones based on key columns. Below are the detailed steps to configure it.
Step 1: Add Upsert Destination to Data Flow
- Drag and drop the Upsert Destination component from the SSIS Toolbox.
- Connect your source component (e.g., JSON / REST / Other Source) to the Upsert Destination.
Step 2: Configure Target Connection
- Double-click the Upsert Destination component to open the configuration window.
- Under Connection, select an existing target connection or click NEW to create a new connection.
- Example: SQL Server, or PostgreSQL, or Amazon Redshift.
Step 3: Select or Create Target Table
- In the Target Table dropdown, select the table where you want to load data.
- Optionally, click NEW to create a new table based on the source columns.
Configure SSIS Upsert Destination Connection - Loading data (REST / SOAP / JSON / XML /CSV) into SQL Server or other target using SSIS
Step 4: Map Columns
- Go to the Mappings tab.
- Click Auto Map to map source columns to target columns by name.
- Ensure you check the Primary key column(s) that will determine whether a record is inserted or updated.
- You can manually adjust the mappings if necessary.
Step 5: Save Settings
- Click OK to save the Upsert Destination configuration.
Step 6: Optional: Add Logging or Analysis
- You may add extra destination components to log the number of inserted vs. updated records for monitoring or auditing purposes.
Step 7: Execute the Package
- Run your SSIS package and verify that the data is correctly inserted and updated in the target table.
Conclusion
In this post, we saw how easy it is to read SAP S4 HANA data using XML Source SSIS connector that is part of ZappySys SSIS PowerPack. Download it, try it out, and see it for yourself! It has many more connectors that were not mentioned in this post but could be also very helpful in your daily work.






