Introduction.
Integration of .Net Application With SAP Using ERPConnect. You can use following ways to connect SAP system- RFC (Function Call)
- BAPI
- Idoc
- SAP Queries
- 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 :
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;
}
}
}
}
No comments:
Post a Comment