ERPConnect.R3Connection
Namespace: ERPConnect
Assembly: ERPConnectStandard20.dll
R3Connection represents a connection to a SAP R/3 System
Inheritance
Implements
Inherited Members
object.GetType(), object.MemberwiseClone(), object.ToString(), object.Equals(object?), object.Equals(object?, object?), object.ReferenceEquals(object?, object?), object.GetHashCode()
Constructors
R3Connection()
Initializes a new instance of the R3Connection class
R3Connection(string, int, string, string, string, string)
Initializes a new instance of the R3Connection class and sets the logon data for a single application server
public R3Connection(string host, int systemNumber, string userName, string password, string language, string client)
Parameters
host
string
Host name of the application server
systemNumber
int
System number of the application server
userName
string
Logon name
password
string
Logon password
language
string
Logon language
client
string
Logon client
R3Connection(string, int, SNCSettings, string, string)
Initializes a new instance of the R3Connection class and sets the logon data for a single application server with SNC authentication
public R3Connection(string host, int systemNumber, SNCSettings sncSettings, string language, string client)
Parameters
host
string
Host name of the application server
systemNumber
int
System number of the application server
sncSettings
SNCSettings
Settings for SNC
language
string
Logon language
client
string
Logon client
Properties
AliasUser
Property Value
CacheMetadata
Get / sets whether the meta data of functions, queries etc. is stored and recycled when a new Create... statement is called.
Property Value
Client
Gets / sets the logon client
Property Value
Codepage
Property Value
CpicConversationId
Gets the Id of the underlying CPI-C connection
Property Value
DynamicABAPCustomFunction
Sets the name of the function module which is used by the ABAPCode class.
Property Value
Host
Gets / sets the host name
Property Value
Remarks
Only required when using logon to a single application server
InitialEncoding
Gets or sets initial encoding (required for some special characters in passwords).
Property Value
Remarks
ERPConnect.ClientProtocol.NWRFC
only.
IsOpen
Gets a value indicating whether this connection has been successfully established and has been valid when the last message has been received/sent. To actively check the current state, please use ERPConnect.R3Connection.Ping
Property Value
IsUnicode
Defines whether the partner system is a unicode system
Property Value
KernelRelease
The kernel release number of the SAP system
Property Value
Examples
700
Language
Gets / sets the logon language
Property Value
Examples
DE od EN
LogDir
Gets or sets the path to the directory in which trace files and XML log files are stored
Property Value
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
Property Value
Remarks
Must be set before the connection is opened. ERPConnect.IR3Connection.LogDir
must also be set.
LogonGroup
Gets / sets the logon group
Property Value
Remarks
Only required when using logon by load balancing
LogonTicket
Property Value
MessageServer
Gets / sets the SAP message server
Property Value
Remarks
Required for logon via load balancing
MessageServerService
Gets or sets the non-standard service the message server listens on. Corresponds to NetWeaver connection parameter "MSSERV".
Property Value
PartnerRelease
The release number of the SAP-BASIS of the system
Property Value
Examples
700
Password
Gets/ sets the user's password for authentication
Property Value
Protocol
Get / sets the ERPConnect.ClientProtocol
for the communication between client and SAP server
Property Value
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)
.
Property Value
SAPEncodingInfo
Gets information about data encoding
Property Value
SAProuterString
Gets or sets the parameters to use when the connection should be made through a SAProuter. Corresponds to NetWeaver connection parameter "SAPROUTER".
Property Value
SID
Gets / sets SAP System ID
Property Value
Remarks
Only required when using logon by load balancing
SNCSettings
Gets or sets the settings for SNC
Property Value
See Also
SkipGetSystemInfo
Gets or sets a value which indicates whether details about the SAP system are obtained through an RFC function call, if necessary.
Property Value
Remarks
Only set to true, if there's no other way!
SystemNumber
Gets / sets the system number
Property Value
Remarks
Only required when using logon to a single application server
TlsSettings
Gets or sets TLS settings to use when connecting using WebSockets. Corresponds to NetWeaver connection parameters related to TLS. Only used when ERPConnect.R3Connection.UsesWebSocket
is set to true and using ERPConnect.ClientProtocol.NWRFC
.
Property Value
Remarks
SAP systems require you to use TLS (ERPConnect.R3Connection.TlsSettings
) when connecting with RFC over WebSocket.
TraceLevel
Verbosity of NetWeaver RFC library trace messages.
Property Value
UseDeltaManager
Gets or sets whether the delta manager is to be used for (de-)serializing TABLES parameters. If unset (null) the default NetWeaver library value is used. Corresponds to NetWeaver connection parameter "DELTA".
Property Value
bool?
UseGui
Defines whether the SAP GUI should be used
Property Value
UserName
Gets / sets the user name for authentication
Property Value
UsesLoadBalancing
Gets or sets a value indicating whether load balancing is used or not
Property Value
UsesWebSocket
Gets or sets whether to use RFC over WebSocket. When set to true the following properties have to be specified:
- `ERPConnect.R3Connection.WebSocketHost`
- `ERPConnect.R3Connection.WebSocketPort`
- `ERPConnect.R3Connection.TlsSettings`
Property Value
Remarks
SAP systems require you to use TLS (ERPConnect.R3Connection.TlsSettings
) when connecting with RFC over WebSocket.
WebSocketHost
Gets or sets the hostname to use when connecting using WebSockets. Corresponds to NetWeaver connection parameter "WSHOST". Only used when ERPConnect.R3Connection.UsesWebSocket
is set to true and using ERPConnect.ClientProtocol.NWRFC
.
Property Value
Remarks
SAP systems require you to use TLS (ERPConnect.R3Connection.TlsSettings
) when connecting with RFC over WebSocket.
WebSocketPort
Gets or sets the WebSocket port to use when connecting using WebSockets. Corresponds to NetWeaver connection parameter "WSPORT". Only used when ERPConnect.R3Connection.UsesWebSocket
is set to true and using ERPConnect.ClientProtocol.NWRFC
.
Property Value
X509Certificate
Gets or sets an X.509 client certificate
Property Value
Methods
AppendToConnectionString(StringBuilder, string, object)
Appends a key/value-pair to a connection string.
public static void AppendToConnectionString(StringBuilder connectionStringBuilder, string parameterName, object parameterValue)
Parameters
connectionStringBuilder
StringBuilder
parameterName
string
parameterValue
object
Remarks
Usage of connection strings is discouraged, connection properties are preferred.
Clone()
Clones the connection object, but doesn't open it!!!! Please use Open() to open it
Returns
The cloned R3Connection object
Close()
Closes the client connection
ConfirmTID(string)
Confirms a Transaction ID
Parameters
tid
string
Transaction ID
CreateBWCube(string)
Creates a new BWCube object. Please refer to the manual for a sample
Parameters
cubeName
string
Name of BW cube or BW query
Returns
The created BWCube object
CreateBapi(string, string)
Creates a new BusinessObjectMethod object.
Parameters
businessObjectName
string
Name of the Business Object. Case-sensitive
methodName
string
Name of Business Object's method. Case-sensitive
Returns
A BusinessObjectMethod object
Remarks
Please go to folder BAPIGetQty in your Examples folder for example source code.
CreateEmptyIdoc(string, string)
Creates an Idoc object. The segments are empty and have to be filled. Therefore use Idoc.CreateSegment
Parameters
idocType
string
Name of the Idoc type (e.g. MATMAS01)
enhancement
string
Name of the Idoc enhancement (may be empty if no enhancement is needed)
Returns
An empty Idoc object
CreateFunction(string)
Creates a function by the name of the SAP function module
Parameters
name
string
Name of the function module
Returns
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
CreateIdoc(string, string)
Creates a fully initialized Idoc object ready to send ...
Parameters
idocType
string
Name of the Idoc type (e.g. MATMAS01)
enhancement
string
Name of the Idoc enhancement (may be empty is no enhancement is needed)
Returns
A new Idoc object ready for use
CreateQuery(WorkSpace, string, string)
Creates a new Query object
Parameters
workSpace
WorkSpace
Workspace local / global
userGroup
string
Name of user group
queryName
string
Name of query
Returns
The new created Query object
CreateTID()
Creates a new transaction ID
Returns
New transaction ID
Dispose()
Execute(RFCFunction)
Assigns this connection to the supplied ERPConnect.RFCFunction
and then executes the function.
Parameters
function
RFCFunction
FromConnectionString(string)
Parameters
connectionString
string
Returns
GetConnectionStringParameterValue(string, string)
Extracts the value of a parameter from a connection string
public static string GetConnectionStringParameterValue(string connectionString, string parameterName)
Parameters
connectionString
string
The connection string from which the value should be extracted
parameterName
string
The name of the parameter of which the value should be extracted
Returns
The value of the parameter
GetSSOTicket()
Returns
IsSystemEditable()
Checks, whether dynamic ABAP code can be executed.
Returns
Log(string)
This function can be used to access the internal log mechanism
Parameters
message
string
Message to be logged
Open()
Opens a connection to an SAP R/3 system.
Remarks
For opening via Load Balancing please set ERPConnect.R3Connection.UsesLoadBalancing
= true
ParseConnectionString(string)
Parses a connection string and sets all properties accordingly
Parameters
connectionString
string
Remarks
Does not change the ERPConnect.R3Connection.ConnectionString
property
Ping()
Checks, whether the established connection is available
Returns
Whether the operation was successful. No exception is thrown
Remarks
Marks the connection as closed if the operation is not successful.
ToConnectionString()
Generates a connection string based on the values of properties (ignores the ERPConnect.R3Connection.ConnectionString
property).
Returns
Remarks
Usage of connection strings is discouraged, connection properties are preferred.