Contents
Introduction
In out 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 OData REST API interface to access data in your application using HTTP Protocol. We will use SSIS XML Source component to read SAP data and load into SQL Server Table in few clicks.
Prerequisites
Before we perform steps listed in this article, you will need to make sure following prerequisites are met:- SSIS designer installed. Sometimes it is referred as BIDS or SSDT (download it from Microsoft site).
- Basic knowledge of SSIS package development using Microsoft SQL Server Integration Services.
- Make sure ZappySys SSIS PowerPack is installed (download it).
- Optional (If you want to Deploy and Schedule ) - Deploy and Schedule SSIS Packages
About SAP HANA / OData REST API Service
You can expose your SAP Data using ODATA REST API Service. Here is a good article which shows how to expose data as OData Service. For more information on SAP OData Service feature check this SAP help page. If you are new to OData Standard then read here to know more how OData can facilitate data extraction using HTTP REST API. If you need Sample XML based OData Service then use below test URLs.
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
Let’s look at step by step approach on how to read SAP data using SSIS components and then we will load SAP HANA data into SQL Server.
Read SAP HANA data using XML Source
First let’s look at steps to configure XML Source. We will read data from SAP S4 / HANA OData Service and then in next section we will look at how to load data into SQL Server or other target.
- Open SSIS Package
- Drag data flow task from SSIS Toolbox, double click data flow
- From data flow toolbox drag ZS XML Source on to the Data flow designer. Double click it to configure.
- Change Data format to OData. Selecting this option will take care REST API pagination.
- Enter your OData Service URL its typically like 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 Use Credentials and select on New ZS-HTTP connection type
- On HTTP connection, Select Basic Authentication and enter your SAP HANA UserID / Password to call OData Service
- Back to XML Source you can now click on select filter or directly type $.feed.entry[*] as below.
- Click Preview to make sure you can see records.
- Click OK to Save UI
In the next section, we will configure the target to load SAP data in SQL Server using Upsert Destination.
Load into 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 SSIS XML Source. You can download SSIS PowerPack from here and try out yourself ( including many options and 70+ components not discussed in this post).