
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Extract Data from SAP Using .NET Provider
To extract using SSIS, you need to have access to backend system. You can use .NET connector and write a Windows application that extracts data from SAP system using Function Module.
For more details on how to connect SAP using .NET connector, you can refer this blog- https://blogs.sap.com/2013/02/14/connecting-to-sap-with-nco-3/
With use of BAPI’s you can allow external applications to access business processes and data in R/3 system. Below code is used to make call to BAPI. First is to create a class that implements IDestinationConfiguration −
Imports SAP.Middleware.Connector Public Class ECCDestinationConfig Implements IDestinationConfiguration Public Event ConfigurationChanged(ByVal destinationName As String, ByVal args As RfcConfigurationEventArgs) Implements IDestinationConfiguration.ConfigurationChanged Public Function GetParameters(ByVal destinationName As String) As RfcConfigParameters Implements IDestinationConfiguration.GetParameters Dim parms As New RfcConfigParameters Select Case destinationName Case "ECDCLNT140" parms.Add(RfcConfigParameters.AppServerHost, "10.1.1.1") parms.Add(RfcConfigParameters.SystemNumber, "00") parms.Add(RfcConfigParameters.SystemID, "ECD") parms.Add(RfcConfigParameters.User, "username") parms.Add(RfcConfigParameters.Password, "secret") parms.Add(RfcConfigParameters.Client, "140") parms.Add(RfcConfigParameters.Language, "EN") parms.Add(RfcConfigParameters.PoolSize, "5") parms.Add(RfcConfigParameters.MaxPoolSize, "10") parms.Add(RfcConfigParameters.IdleTimeout, "600") Case Else End Select Return parms End Function Public Function ChangeEventsSupported() As Boolean Implements IDestinationConfiguration.ChangeEventsSupported Return False End Function End Class
Next is to create a Web Services which used .Net 3.0 connector to call RFC Function Module.
Imports SAP.Middleware.Connector Module Driver Private _ecc As RfcDestination Sub Main() RfcDestinationManager.RegisterDestinationConfiguration(New ECCDestinationConfig) Try _ecc = RfcDestinationManager.GetDestination("ECDCLNT140") GetCompanyName() Catch ex As Exception System.Console.WriteLine(ex.Message) System.Console.ReadLine() End Try End Sub Private Sub GetCompanyName() System.Console.WriteLine(String.Format("Successfully connected to System {0} Client {1}.", _ecc.SystemID, _ecc.Client)) System.Console.WriteLine("Enter a company ID:") Dim companyID As String = System.Console.ReadLine() While Not String.IsNullOrEmpty(companyID.Trim) Dim companyAPI As IRfcFunction = _ecc.Repository.CreateFunction("BAPI_COMPANY_GETDETAIL") companyAPI.SetValue("COMPANYID", companyID) companyAPI.Invoke(_ecc) Dim companyName As String = companyAPI.GetStructure("COMPANY_DETAIL").GetString("NAME1") If String.IsNullOrEmpty(companyName.Trim) Then companyName = "Not found" End If System.Console.WriteLine(companyName) companyID = System.Console.ReadLine() End While End Sub End Module
Advertisements