Skip to content

ERPConnect.IR3Connection

Namespace: ERPConnect
Assembly: ERPConnectStandard20.dll

Represents a connection to a SAP R/3 System

public interface IR3Connection : IDisposable

Implements

IDisposable

Properties

Codepage

string Codepage { get; }

Property Value

string

IsOpen

Gets a value indicating whether this connection has been successfully established and has been valid when the last message has been received/sent.

bool IsOpen { get; }

Property Value

bool

IsUnicode

Defines whether the partner system is a unicode system

bool IsUnicode { get; }

Property Value

bool

Language

Gets the logon language

string Language { get; }

Property Value

string

Examples

DE od EN

LogDir

Gets or sets the path to the directory in which trace files and XML log files are stored

string LogDir { get; set; }

Property Value

string

Remarks

To enable logging, set the value to an existing directory to which the process has write access. To disable logging set the value to string.Empty. Property must be set before the connection is opened.

Logging

Gets or sets a value which indicates whether detailed RFC tracing is enabled or not

bool Logging { get; set; }

Property Value

bool

Remarks

Must be set before the connection is opened. ERPConnect.IR3Connection.LogDir must also be set.

PartnerRelease

The release number of the SAP-BASIS of the system

string PartnerRelease { get; }

Property Value

string

Examples

700

Protocol

The ERPConnect.ClientProtocol used for the communication between client and SAP server

ClientProtocol Protocol { get; }

Property Value

ClientProtocol

ReadTableFunctionName

Gets or sets the name of the function module that is used by ERPConnect.Utils.ReadTable. This will be overriden by ERPConnect.Utils.ReadTable.SetCustomFunctionName(System.String).

string ReadTableFunctionName { get; set; }

Property Value

string

SAPEncodingInfo

Gets information about data encoding

SAPEncodingInfo SAPEncodingInfo { get; }

Property Value

SAPEncodingInfo

SNCSettings

Gets or sets the settings for SNC

SNCSettings SNCSettings { get; set; }

Property Value

SNCSettings

See Also

IR3Connection.SNCSettings

Methods

Close()

Closes the client connection

void Close()

CreateFunction(string)

Creates a function by the name of the SAP function module

RFCFunction CreateFunction(string name)

Parameters

name string

Name of the function module

Returns

RFCFunction

A RFCFunction object

Examples

[C#]

static void Main(string[] args)
{
    R3Connection con = new R3Connection("hamlet",11,"theobald","pw","DE","800");
    con.Open(false);

    // Create a function object
    RFCFunction func = con.CreateFunction("RFC_CUSTOMER_GET");

    Console.WriteLine("Please enter customer number ...");
    Console.WriteLine("(and do not forget the leading zeros ...");

    // fill the export parameter
    StringBuilder CustomerNo =  new StringBuilder(Console.ReadLine());
    func.Exports["KUNNR"].ParamValue = CustomerNo.ToString();

    try 
    {
    func.Execute();
    }
    catch (ERPException e)
    {
        Console.WriteLine(e.Message);
        Console.ReadLine();
        return;
    }

    // Output the result of the function module
    Console.WriteLine("Name of customer:");
    Console.WriteLine(func.Tables["CUSTOMER_T"].Rows[0,"NAME1"]);
    Console.ReadLine();
}

[VB]

Sub Main()
    Dim con As New R3Connection("hamlet", 11, "theobald", "pw", "DE", "800")
    con.Open(False)

    ' Create a function object
    Dim func = con.CreateFunction("RFC_CUSTOMER_GET")

    Console.WriteLine("Please enter customer number ...")
    Console.WriteLine("(and do not forget the leading zeros ...")

    ' fill the export parameter
    Dim CustomerNo As New StringBuilder(Console.ReadLine())
    func.Exports("KUNNR").ParamValue = CustomerNo.ToString()

    Try
        func.Execute()
    Catch e As ERPException
        Console.WriteLine(e.Message)
        Console.ReadLine()
        Return
    End Try

    ' Output the result of the function module
    Console.WriteLine("Name of customer:")
    Console.WriteLine(func.Tables("CUSTOMER_T").Rows(0, "NAME1"))
    Console.ReadLine()
End Sub

Remarks

The following example demonstrates, how to logon, to create a function object and to execute the function

Execute(RFCFunction)

Assigns this connection to the supplied ERPConnect.RFCFunction and then executes the function.

void Execute(RFCFunction function)

Parameters

function RFCFunction

Open()

Opens a connection to an SAP R/3 system.

void Open()

Last update: January 10, 2024