Click here to Skip to main content
15,886,110 members
Articles / Web Development / ASP.NET
Article

Integration of .Net Application With SAP

Rate me:
Please Sign up or sign in to vote.
4.25/5 (4 votes)
23 Apr 2008CPOL1 min read 45.8K   35   2
Connecting .Net & SAP

Introduction.

Integration of .Net Application With SAP Using ERPConnect. You can use following ways to connect SAP system

  1. RFC (Function Call)
  2. BAPI
  3. Idoc
  4. SAP Queries
  5. Special Classes etc many more

What is SAP .Net Connector

  • SAP product. Based on Microsoft .NET Technology
  • Interact with SAP via RFC/SOAP
  • Fully integrated with Visual Studio.NET
  • Managed Code
  • Generates C# Proxy Classes for any .NET application integrations
  • Supports RFC and SOAP
  • Supports qRFC, tRFC
  • Supports asynchronous SOAP calls
  • RFC client or RFC server

Brief About ERPConnect

ð ERPConnect.net is a lean .NET assembly that lets you develop robust SAP interfaces without a great degree of effort and most of all, without an elaborate infrastructure or any additional middleware.

ð Supports RFC and SOAP, therefore integrates itself in any modern SAP NetWeaver architecture

ð Also suitable for use on mobile devices

ð ERPConnect.net also offers a range of special classes to efficiently, securely and stably handle even the most exotic requirements of SAP interface programming

ð Read SAP tables directly through RFC

Resources Required

  • SAP .Net Connector: ERPConnect
  • SAP Server Details
    • name/IP of the SAP server
    • System Number
    • User name
    • Password
    • Language
    • Client

Using the code

First install ERPConnect in the dev environment. After installing ERPConnect, goto Add References block in the application, locate the ERPConnect.dll and hit add.Once the ERPConnect.dll is added to the reference folder. you can add following to the xyz.cs file Now its all upto you. You can implement as you wish.In the code belo I am using the concept of Special Classes.

Block of code :

C#
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Data.Odbc;
using ERPConnect;
using ERPConnect.Utils;
using ERPConnect.Queries;
 
namespace SAP1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
try
{
//licence
   ERPConnect.LIC.SetLic(); //Not Required in case of trial version but is must in case of licenced version

//creating the connection object
R3Connection con = new R3Connection("SAP Server IP/Name", System Number, "UserName", "PWDl", "Language", "Client");

//open the connection
con.Open();

DataTable dt = new DataTable();
ReadTable rt = new ReadTable(con);

rt.TableName = "SAP Table Name";
rt.AddField("FieldName");
rt.AddField("FieldName");


rt.Run();
dt = rt.Result;
dataGridView1.DataSource = dt; // displays the result in gridview
}
catch (Exception ex)
{
 textBox1.Text = ex.Message;
}

}
}
}

Points of Interest

License

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


Written By
Technical Lead Persistent Systems
India India
Working as Project Lead in Persistent Systems, CMMI level 5 company. http://www.Persistent.co.in

Comments and Discussions

 
QuestionERPConnect Pin
Anuradha Wijesinghe4-Jun-13 23:38
Anuradha Wijesinghe4-Jun-13 23:38 
GeneralAn alternative for Visual Studio 2005 / 2008 Pin
peterklausen17-Oct-09 15:16
peterklausen17-Oct-09 15:16 

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.