Click here to Skip to main content
15,883,883 members
Articles / Web Development / ASP.NET
Tip/Trick

SAP Integration with .Net 4.0 (SAP Connection Manager)

Rate me:
Please Sign up or sign in to vote.
3.67/5 (9 votes)
11 Jan 2013CPOL2 min read 130.5K   10.6K   37   16
Integration of SAP with .NET using SAPConnectionManager.

Introduction 

This is a simple, C# class library project to connect .NET applications with SAP. This component internally implements SAP .NET Connector 3.0. The SAP .NET Connector is a development environment that enables communication between the Microsoft .NET platform and SAP systems. This connector supports RFCs and Web services, and allows you to write different applications such as Web form, Windows form, or console applications in the Microsoft Visual Studio .NET. With the SAP .NET Connector, you can use all common programming languages, such as Visual Basic. NET, C#, or Managed C++.

Features

Using the SAP .NET Connector you can:

  1. Write .NET Windows and Web form applications that have access to SAP business objects (BAPIs).
  2. Develop client applications for the SAP Server.
  3. Write RFC server applications that run in a .NET environment and can be installed starting from the SAP system.  

Using the code 

Following are the steps to configure this utility on your project

Download and extract the attached file and place it on your machine. This package contains 3 libraries:

  1. SAPConnectionManager.dll 
  2. sapnco.dll 
  3. sapnco_utils.dll   

Now go to your project and add the reference of all these four libraries. Sapnco.dll and sapnco_utils.dll are inbuilt libraries used by SAP .NET Connector. SAPConnectionManager.dll is the main component which provides the connection between .NET and SAP. 

Once the above steps are complete, you need to make certain entries related to SAP server on your configuration file. Here are the sample entries that you have to maintain on your own project. You need to change only the values which are marked in Bold. Rest remains unchanged.

XML
<appSettings> 
   <add key="ServerHost" value="127.0.0.1″/>
   <add key="SystemNumber" value="00″/>
   <add key="User" value="sample"/>  
   <add key="Password" value="pass"/>
   <add key="Client" value="50″/>
   <add key="Language" value="EN"/>
   <add key="PoolSize" value="5″/>
   <add key="PeakConnectionsLimit" value="10″/>
   <add key="IdleTimeout" value="600″/>   
</appSettings>

To test this component, create one windows application. Add the reference of sapnco.dll, sapnco_utils.dll, and SAPConnectionManager.dll on your project. 

Paste the below code on your Form lode event

C#
SAPSystemConnect sapCfg = new SAPSystemConnect();
RfcDestinationManager.RegisterDestinationConfiguration(sapCfg);
RfcDestination rfcDest = null;
rfcDest = RfcDestinationManager.GetDestination("Dev");

That’s it. Now you are successfully connected with your SAP Server. Next you need to call SAP business objects (BAPIs) and extract the data and stored it in DataSet or list.   

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



Comments and Discussions

 
GeneralMy vote of 3 Pin
Member 1261304026-Apr-21 21:35
Member 1261304026-Apr-21 21:35 
QuestionRegister multiple destinations at once Pin
Eduardo Chávez7-Apr-16 5:31
Eduardo Chávez7-Apr-16 5:31 
AnswerRe: Register multiple destinations at once Pin
prateek tiwari10-Apr-16 18:53
prateek tiwari10-Apr-16 18:53 
Check out this link. You might get some details here.

Multiple connections with SAP.net connector 3.0 | SCN[^]
GeneralMy vote of 1 Pin
Donkey Master15-Jul-15 2:26
Donkey Master15-Jul-15 2:26 
GeneralMy vote of 4 Pin
goGarfi26-Dec-14 1:50
goGarfi26-Dec-14 1:50 
Questionsource code Pin
freeskydiver5-Sep-14 8:36
freeskydiver5-Sep-14 8:36 
AnswerRe: source code Pin
Jim F. Johnson14-Jan-15 18:31
Jim F. Johnson14-Jan-15 18:31 
QuestionSimple Example Pin
Besaleel M. Vieira10-Jul-14 6:54
Besaleel M. Vieira10-Jul-14 6:54 
AnswerRe: Simple Example Pin
Jim F. Johnson14-Jan-15 18:30
Jim F. Johnson14-Jan-15 18:30 
QuestionHow to connect to RFC ? Pin
Atul Phadtare17-Nov-13 23:12
Atul Phadtare17-Nov-13 23:12 
Questionsource code Pin
Member 359729713-Jul-13 16:24
Member 359729713-Jul-13 16:24 
QuestionThanks Pin
Steve F24-Apr-13 9:38
Steve F24-Apr-13 9:38 
GeneralMy vote of 3 Pin
sandeepkumarvemula11-Feb-13 22:24
sandeepkumarvemula11-Feb-13 22:24 
SuggestionSuggestions to improve the article Pin
oracy13-Jan-13 11:39
oracy13-Jan-13 11:39 
GeneralRe: Suggestions to improve the article Pin
harish kumar bindela11-Jul-13 23:08
harish kumar bindela11-Jul-13 23:08 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.