In this blog I will show, how to create an SSIS package with Xtract IS Table programmatically. Our Package will extract data from an SAP table and load it to the sql server.
This scenario is very helpful to create your own packages, that you can load and reconfigure for different projects and customers.
In an SAP table many fields can belong to the table key. In some scenarios when you extract an SAP table with Xtract IS to load it into an SQL table, you want to replace the sap key fields by another custom key, e.g. a GUID.
To extract data from an SAP BW/BI system, Xtract IS suite provides 3 different components supporting the following interfaces:
MDX engine: Xtract IS BWCube component supports the MDX engine and enables the extraction of InfoCubes and BEx Queries.
Open Hub Services:Xtract IS OHS component supports the Open Hub Services that allow you to distribute data from BW/BI system using Infospokes or Open Hub Destinations.
Export DataSource: An Export DataSource enables the extraction of the following InfoProviders: InfoCubes, DataStores and InfoObjects. In contrast to Export DataSources, DataSources are provided to transfer data from SAP ERP or an external System to BI. Xtract IS DeltaQcomponent supports both DataSources.
In this blog I will focus on Export DataSources and describe how to generate them in SAP BW/BI and how to use them with Xtract IS DeltaQ.
ERPConnect 4.0 has been released. This new Release contains a LINQ to SAP Provider for Visual Studio 2010.
Afther the installation of ERPConnect you must start the program LinqToERPSetupVS2010.exe from the installation folder (C:\Program Files (x86)\ERPConnect) to install LinqToERP.
In Visual Studiocreate new Project andadd New Item. Select the template LINQ to ERP.
This add the file LINQtoERP1.erp to your Solution. Double-Click the file to open the designer.
As you see in the toolbox, LINQ to SAP supports following SAP Object types: Table (and View), Query, IDoc, BAPI and RFC (Function), InfoCube and InfoQuery (BWCube).
Select the table component from the toolbox. Drag and drop it to the designer. The connection dialog opens. Fill in the logon credential and host information and click ok.
The search table dialog opens. Search for a table and select it from the list.
In our sample we add the following 3 Tables:
KNA1: General Customer Data
VBAK: Header data of Sales Documents
VBAP: Item data of Sales Documents
In this blog we create a sample with three master/details Datagridviews with the Tables Customers, SalesHeaders and SalesItems.
create a DataSet
using (SAPContext sc = newSAPContext(username, password))
Here we have used an extension method to convert the Linq Expression to a DataTable. For more Information see the following site: http://weblogs.asp.net/stevesloka/archive/2008/01/28/linq-to-datatable.aspx
Create a customers table and add it to the DataSet
For SSIS based integration processes with SAP R/3, ERP and BI/BW systems, Xtract IS offers many components for sap interface technologies: SAP Table/View, SAP Query, SAP BAPI/RFC, BW Cube (InfoCube, InfoQuery), BW Hierachy, Open Hub Services (OHS), ABAP Report, SAP DeltaQ and BWLoader to load Data into SAP Bw (see http://www.theobald-software.com/en/products/xtractis.htm).
Here is a sample scenario, if you want to send Idocs with SSIS, where the Data are in SQL Tables.
We will create a SSIS Data Flow Task with 3 Components:
-An OLE DB Source for an SQL Database table which contains the Data for the IDocs. In this sample, rows with the same ID belongs to the same Idoc. The Table has a field IDocStatus which saves the result of the IDoc operation. This Tablewill be the source for our custom script component in SSIS. The input Data must be sorted by ID.
-A SSIS script component of type transformation which sends the Idocs to the sap system. The component has one output with two columns: ID and IDocStatus.
-An OLE DB Command wich updates the SQL Datatable with the IDocStatus.
If your Idoc data resides in many Tables, you can create a view und use it as an OLE DB Source. Or you can use an SQL Command in your OLE DB source which joins the tables.
Define an output and add two columns: ID and IdocStatus
In the script Transformation Editor click on Edit Script ... to write your custom code.
·Add Reference to ERPConnect
·Add ERPConnect to your references.
·The ERPConnect.dll must be deployed to the GAC.
·There is a peculiar limitation of VSA that requires you to place any DLLs that you want to reference into the Microsoft.Net\Framework folder of your development machine.