Aug 27

Using the SAP .Net Connector in Visual Studio 2008

Overview

This blog post describes how to use an SAP .Net Connector proxy, created in a VS 2003 project, in a Visual Studio 2008 C# solution.

[Editor’s Note]
This blog is third in a multi-part series describing how to use the SAP .NET Connector:

 

  1. Introduction to the SAP .Net Connector
  2. Building an SAP .NET Connector Proxy
  3. Using the SAP .Net Connector in Visual Studio 2008

 

Introduction

Our previous post described how to use Visual Studio 2003 and the SAP .Net Connector to create a Dynamic Link Library containing the desired SAP functionality. The DLL contains proxies for each SAP function that we want to utilize.

We will reference that DLL in a Visual Studio 2008, and use it to retrieve system information from an SAP host.

As a demonstration, we are creating the TLA System, which exists solely to demonstrate certain SAP .Net Connector programming techniques.

Using the SAP .Net Connector Proxy

Now we are ready to put our SAP .Net Connector Proxy to work. This will allow us to use the SAP .Net Connector in the modern Visual Studio environment.

Start a Visual Studio 2008 Project

Start a new Visual Studio 2008 Project. Use the Console Application template, and name the solution TlaSapRfcClient.

Creating a new console application

Creating a new console application

Add a Reference to the TLA SAP Proxy

Now we need to add a reference to the DLL we created earlier.

In the Solution Explorer, right click References and choose Add Reference. Using the Browse tab, find the TlaSapProxy.dll file from the TlaSapProxy project. Typically, this will be in the bindebug folder of the TlaSapProxy folder. Click the OK button to add the reference to your project.

Adding a reference to the proxy

Adding a reference to the proxy

C# Code

Here is a Visual Studio 2008 C# program that uses the SAP .Net Connector proxy that we built earlier using Visual Studio 2003.

C# program listing

C# program listing

When we create an instance of the proxy in line 11, we pass in an SAP connection string. We create an object of type SAPProxy1 because that is what we named it in our Visual Studio 2003 project.

In line 20, we create an object of type RFCSI, because that is what our RFC call to Rfc_Get_System_Info will return. The type definition for RFCSI was also included in the proxy.

In line 22 we make the RFC call to the SAP host. We get full IntelliSense support that describes the parameters required.

Summary

The SAP .Net Connector is built for Visual Studio 2003. By using Visual Studio 2003 to create a DLL, we can use the SAP .Net Connector in Visual Studio 2008 (or later).

Here we have described how to use that DLL in a Visual Studio 2008 project.

Avatar

About The Author

9 Comments

  1. […] Using the SAP .Net Connector in Visual Studio 2008 […]

  2. […] Using the SAP .Net Connector in Visual Studio 2008 […]

  3. Avatar
    SAF
    November 24, 2009 at 12:11 pm · Reply

    Hi,
    Can you share the dll for me?

    • Avatar
      Craig Stasila
      December 1, 2009 at 8:08 am · Reply

      The SAP .NET Connector is available from the SAP Service Marketplace: http://service.sap.com/connectors. You must have access to the SAP Service Marketplace to download. Unfortunately, we are unable to redistribute the installation file.

  4. Avatar
    Sonal
    January 14, 2010 at 7:55 am · Reply

    Thanks for this detailled explanation. it really will help me.

  5. […] We will use Visual Studio 2003 to create a DLL that manages the interactions with the SAP host. The SAP .Net Connector version 2.0 works with Visual Studio 2003 or 2005. To use the .Net Connector in our preferred environment of Visual Studio 2008, we will create the proxy DLL in 2003 and add that to our 2008 project. The techniques are described in our earlier post, Using the SAP .Net Connector in Visual Studio 2008. […]

  6. Avatar
    website design gold coast
    November 7, 2010 at 6:50 pm · Reply

    any instruction to use webservice using visual studio 2010 and dot net 4

  7. Avatar
    Mike Parker
    February 18, 2011 at 11:18 am · Reply

    After this process is complete will the resulting .exe require the .NET 1.1 runtime?

    We are running into this issue with WIN2K8. It will not allow .NET 1.1 to be installed.

    This technique would be great for us if it does not required the 1.1 runtime.

  8. Avatar
    justice
    July 4, 2011 at 7:36 am · Reply

    I am unable to see the .Net Connector from the VS Templates, I am using the VS 2008. Please assist on how to get it shown on the VS Templates. I have installed the .Net Connector 3.0 successfully but it doesnt show when I go to Add new Items.

Leave a reply

Your email address will not be published. Required fields are marked *

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

This site uses Akismet to reduce spam. Learn how your comment data is processed.