SAP Connection
This section contains information on how to connect to SAP systems. ERPConnect supports the following connection methods to SAP systems:
- Connect to a single application server.
- Connect to a message server (Load Balancing).
- Connect to a single application server or public or private cloud instance via RFC over WebSocket.
Prerequisites
ERPConnect requires an RFC library, see SAP Libraries.
The RFC API (Remote Function Call) enables an RFC connection between an SAP system and an external system that can communicate with SAP as a client or server. The RFC API has two versions:
- classic RFC-API (classic RFC library).
- Netweaver-RFC-API (Netweaver RFC library).
For more information on the RFC libraries, see SAP Help - RFC API: Classical & NetWeaver.
Input Parameters
The connection methods require the following input:
| Single Application Server | Load Balancing | RFC over WebSocket |
|---|---|---|
| Name of the user (UserName property) | Name of the user (UserName property) | Name of the user (UserName property) |
| Password (Password property) | Password (Password property) | Password (Password property) |
| Language (Language property) | Language (Language property) | Language (Language property) |
| Client (Client property) | Client (Client property) | Client (Client property) |
| Name of the application server (Host property) | Name of the message server (MessageServer property) | WebSocket host (WebSocketHost property) |
| System number between 0 and 99 (SystemNumber property) | System ID (SID property e.g., MBS) | WebSocket port (WebSocketPort property) |
| Name of the group (LogonGroup property e.g., PUBLIC) | AliasUser property instead of UserName for cloud systems | |
| Various TLS settings (TlsSettings property), e.g., CryptoLibrary, ClientPse |
Connect to SAP
To connect an SAP system:
- Add the
ERPConnect.dllclass library as a reference to the project. - Create a new
R3Connectionobject and define all input parameters. -
Establish the connection using
Open.
ERPConnect can now access data in your SAP system.
Encoding
The default encoding for an SAP connection is SAP code page 1100 (iso-8859-1). When using the NW RFC protocol you can explicitly set an encoding. This is necessary if your SAP credentials contain characters that are not part of SAP code page 1100.
Client Protocol
The default client protocol is the NWRFC Protocol. To use the old RFC Protocol add the following command:
Tip
If you use the constructor of the R3Connection class to provide the login properties, you can save lines.
Example: R3Connection con = new R3Connection("SAPServer",00,"SAPUser","Password","EN","800");.
Note
For more information on authentication, see SSO with Log On Tickets and SSO with SNC.
Connect via Router
When accessing an SAP system via a Router, the router string must be set before the host name or the name of the message server.
For more information on route strings, see SAP Help- Route String Entry for SAProuter.
| Connect to SAP via Router | |
|---|---|