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}):
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
- Inside Data Flow, Drag and drop Upsert Destination Component from SSIS Toolbox
- Connect our Source component to Upsert Destination
- Double click Upsert Destination to configure it
- Select Target Connection or click NEW to create new connection Configure SSIS Upsert Destination Connection - Loading data (REST / SOAP / JSON / XML /CSV) into SQL Server or other target using SSIS
- Select Target Table or click NEW to create new table based on source columns
- Click on Mappings Tab to Auto map columns by name. You can change mappings as you need SSIS Upsert Destination - Columns Mappings
- Click OK to Save Upsert Destination Settings
- That's it, You are now ready to run data flow. NOTE: If you wish to debug data flow and see records when you run, add data viewer by right click on blue arrow > Click Enable Data Viewer
- To execute data flow, Right click anywhere inside Data Flow Surface and click Execute Task
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.