ERP Integrator V2 - Online Help
ERP Integrator V2
Questions / Feedback?

SapClient Class

Properties   Methods   Events   Configuration Settings   Errors  

The SapClient makes communication between a client application and a SAP R/3 (NetWeaver) server extremely easy. This component is used to make remote function calls to the SAP system, and provides a simple interface for sending and receiving parameters and tables to and from those remote functions.

Class Name

InERP_SapClient

Procedural Interface

 inerp_sapclient_open();
 inerp_sapclient_close($res);
 inerp_sapclient_register_callback($res, $id, $function);
 inerp_sapclient_get_last_error($res);
 inerp_sapclient_get_last_error_code($res);
 inerp_sapclient_set($res, $id, $index, $value);
 inerp_sapclient_get($res, $id, $index);
 inerp_sapclient_do_abortconnection($res, $errormessage);
 inerp_sapclient_do_callfunction($res);
 inerp_sapclient_do_closeconnection($res);
 inerp_sapclient_do_config($res, $configurationstring);
 inerp_sapclient_do_createid($res);
 inerp_sapclient_do_doevents($res);
 inerp_sapclient_do_getattributes($res);
 inerp_sapclient_do_getfunctioninfo($res);
 inerp_sapclient_do_gettableinfo($res);
 inerp_sapclient_do_interrupt($res);
 inerp_sapclient_do_openconnection($res);
 inerp_sapclient_do_reset($res);
 inerp_sapclient_do_setrequestparam($res, $name, $value);

Remarks

The purpose of this class is to make executing remote functions on a SAP server extremely simple.

There are just a few steps you need to make before you can begin making transactions: First set the connection credentials and connect to the SAP system (see Setting Up a Connection with a SAP System for details).

Next set the FunctionName of the remote function you wish to call, and use GetFunctionInfo to retrieve the RequestParameters, ResponseParameters, and tables that the remote function uses. Then you set the values of any RequestParameters you want to send and call CallFunction. The ResponseParameters will contain the results from the function call, and the TableIndex, RowIndex, and Columns properties can be used to access any table data received.

The following example shows how to search for all of the RFC functions available on the SAP system. First we provide login credentials and connect.

  SapClient1.SapConnectionConnectionType = ctNetWeaver
  SapClient1.SapConnectionClient = "000"
  SapClient1.SapConnectionDestination = ""
  SapClient1.SapConnectionHost = "localhost"
  SapClient1.SapConnectionUser = "BCUSER"
  SapClient1.SapConnectionPassword = "minisap"
  SapClient1.SapConnectionSystemNumber = 0
  SapClient1.OpenConnection()
Note that the credentials above are for connecting to a trial NetWeaver installation. You will need to provide your own credentials when connecting to your own SAP installation.

Since we want to retrieve a list of RFC functions, we're now going to set the FunctionName to "RFC_FUNCTION_SEARCH", which should be available on all SAP installations.

  SapClient1.FunctionName = "RFC_FUNCTION_SEARCH";
  SapClient1.GetFunctionInfo();
After calling GetFunctionInfo the RequestParameters will contain three entries. "FUNCNAME", "GROUPNAME", and "LANGUAGE", which are used as search criteria. There aren't any ResponseParameters used by this remote function, but there is an empty table named "FUNCTIONS" at TableIndex 0. To retrieve a list of all RFC functions, set the "FUNCNAME" parameter to "RFC*" (If we set the parameter to "*" several thousand irrelevant functions may be returned).
  SapClient1.SetRequestParam("FUNCNAME", "RFC*");
  SapClient1.CallFunction();
  SapClient1.CloseConnection();  
The results of the "RFC_FUNCTION_SEARCH" remote call are now contained in the table at TableIndex 0, and may be accessed like this:
  for (int row = 0; row < SapClient1.RowCount; row++) {
    SapClient1.RowIndex = row;
    for (int col = 0; col < SapClient1.Columns.Count(); col++) {          
      SapColumn curr = (SapColumn)SapClient1.Columns.ElementAt(col);
      Console.WriteLine(curr.Name + " = \"" + curr.Value.Trim() + "\" (" + curr.ColumnType + ")");          
    }
    Console.WriteLine("");  
  }
The above code will output something very similar to this:
FUNCNAME = "RFCPING" (ctCharacters)
GROUPNAME = "SYST" (ctCharacters)
APPL = "" (ctCharacters)
HOST = "" (ctCharacters)
STEXT = "RFC Ping" (ctCharacters)

FUNCNAME = "RFC_ABAP_INSTALL_AND_RUN" (ctCharacters)
GROUPNAME = "SUTL" (ctCharacters)
APPL = "S" (ctCharacters)
HOST = "" (ctCharacters)
STEXT = "" (ctCharacters)

FUNCNAME = "RFC_CALL_TRANSACTION_USING" (ctCharacters)
GROUPNAME = "MRFC" (ctCharacters)
APPL = "S" (ctCharacters)
HOST = "" (ctCharacters)
STEXT = "Verification Program for Execution of RFCs via CALL TRANSACTION USING" (ctCharacters)

...

Dependency Notes

If the class is not configured to use the SOAP interface, it will use the sapnwrfc.dll, librfc32.dll, librfc32u.dll, or the Java Connector (JCo) to connect to the SAP system. Although the Java Connector is only available when programming in Java on Windows.

The NetWeaver RFC SDK (sapnwrfc.dll) offers both a 32 bit and 64 bit version. Likewise, the SAP RFC SDK offers as 32 bit and 64 bit version of both a unicode (librfc32u.dll) and non-unicode (librfc32.dll) library.

The NetWeaver RFC SDK will be used if the SapConnectionType is set to ctNetWeaver (0). The following libraries from the NetWeaver RFC SDK must be available at runtime:

  • sapnwrfc.dll
  • icudt30.dll
  • icuin30.dll
  • icuuc30.dll
  • libicudecnumber.dll
  • libsapucum.dll
Note that the dll names may be different depending on the version of the SAP RFC SDK installed. The examples above are for version 3.0.

The non-unicode library will be used if the SapConnectionType is set to ctClassic (1). This simply requires that the librfc32.dll be placed in a location that is accessible at runtime. (0).

The unicode library will be used if the SapConnectionType is set to ctClassicUnicode (2). The following libraries from the SAP RFC SDK must be available at runtime:

  • librfc32u.dll
  • icudt30.dll
  • icuin30.dll
  • icuuc30.dll
Note that the dll names may be different depending on the version of the SAP RFC SDK installed. The examples above are for version 3.0.

The Java Connector (JCo) will be used if the SapConnectionType is set to ctJavaConnector (4). In order to use this, you must first add the sapjco3.jar file to your project.

The 32 bit and 64 bit versions do not require any special settings within the classs. The only requirement is that your application target the same platform as the DLL.

Property List


The following is the full list of the properties of the class with short descriptions. Click on the links for further details.

ColumnCountThe number of records in the Column arrays.
ColumnTypeThe type of the column.
ColumnLengthThe maximum length of the data stored in Value .
ColumnNameThe name of the column.
ColumnTableIndexThis should be set if the ColumnType is set to ctTable.
ColumnValueThis is the actual data contained in the column.
ConnectedIndicates whether or not the component is connected to the SAP system.
FunctionNameThe name of the remote function you wish to call.
RequestParameterCountThe number of records in the RequestParameter arrays.
RequestParameterLengthThis contains the length of the current parameter.
RequestParameterNameName of the parameter.
RequestParameterTypeThe type of the parameter.
RequestParameterTableIndexThis corresponds to the TableIndex of the table that is to be passed as a parameter or as a parameter from NetWeaver.
RequestParameterTableTypeIf ParamType is set to ptTable, this property will correspond with the TableType that corresponds to TableIndex .
RequestParameterValueActual data sent to or received from remote function call.
ResponseParameterCountThe number of records in the ResponseParameter arrays.
ResponseParameterLengthThis contains the length of the current parameter.
ResponseParameterNameName of the parameter.
ResponseParameterTypeThe type of the parameter.
ResponseParameterTableIndexThis corresponds to the TableIndex of the table that is to be passed as a parameter or as a parameter from NetWeaver.
ResponseParameterTableTypeIf ParamType is set to ptTable, this property will correspond with the TableType that corresponds to TableIndex .
ResponseParameterValueActual data sent to or received from remote function call.
RowCountThe total number of rows in the table.
RowDataThe raw binary data that makes up a row.
RowIndexThe index of the current row. When a table is returned Name will be populated with the name of the column and Value will be populated with the data for the column that correspond to the row specified here. In the event the table contains no data, set this to -1 to retrieve information about the fields. When set to -1, Name , Length , and ColumnType will be populated with the field information for each column.
SapAttributeApplicationNameThe name of the calling program.
SapAttributeClientThe client authenticating to the SAP system.
SapAttributeDestinationDestination that you are currently connected to.
SapAttributeKernelVersionThe release version of the kernel.
SapAttributeLanguageOne character code indicating the language of the system.
SapAttributeLanguageCodeTwo-character ISO 639-1 code indicating the language of the system.
SapAttributeOwnCodePageThe code page of your system.
SapAttributeOwnHostThe name of the host you're connected to.
SapAttributeOwnTypeThe type of your own system.
SapAttributeOwnVersionThe release version of your system.
SapAttributePartnerCharSizeThe length of a character on the partner's system.
SapAttributePartnerCodePageThe code page of your partner's system.
SapAttributePartnerHostPartner host name.
SapAttributePartnerTypeThe type of the partner's system.
SapAttributePartnerVersionThe release version of the partner's system.
SapAttributePasswordStateThe state of the password.
SapAttributeReservedThis property may contain an additional 160 bytes of data which is reserved for future new attributes returned by the R/3 server.
SapAttributeRoleIndicates whether you're connected as a client or server application.
SapAttributeSystemNameThe name or id of the R/3 system you're currently connected to.
SapAttributeSystemNumberThe system number of the R/3 server you're connected to.
SapAttributeTraceOnIndicates whether debug tracing is active or not.
SapAttributeUserThe login credential which was used to connect to the R/3 server.
SapConnectionClientThe client authenticating to the SAP system.
SapConnectionTypeSpecifies how the connection is made to the SAP server.
SapConnectionDestinationReference to an existing destination that is specified in a local saprfc.
SapConnectionGatewayHostThe gateway host you wish to connect to.
SapConnectionGatewayServiceThe gateway service you wish to connect to.
SapConnectionHostHost name of the target system.
SapConnectionLanguageThe language value to be used when connecting SAP system.
SapConnectionPasswordThe password used to authenticate to the SAP system.
SapConnectionSoapURLThe URL of the SOAP service on the SAP system.
SapConnectionSystemNumberThe number by which the target system is defined.
SapConnectionUserThe user that is authenticating to the SAP system.
SSLAcceptServerCertEncodedThe certificate (PEM/base64 encoded).
SSLCertEncodedThe certificate (PEM/base64 encoded).
SSLCertStoreThe name of the certificate store for the client certificate.
SSLCertStorePasswordIf the certificate store is of a type that requires a password, this property is used to specify that password in order to open the certificate store.
SSLCertStoreTypeThe type of certificate store for this certificate.
SSLCertSubjectThe subject of the certificate used for client authentication.
SSLServerCertEncodedThe certificate (PEM/base64 encoded).
TableCountTotal number of tables used by the remote function call.
TableIndexThe index of the current table.
TableNameThe name of the current table.
TableRowLengthLength of each row in the current table.
TableTypeThe type of the current table.
TimeoutLength of time in seconds the component waits for a response from the SAP system.
TransactionIdA transaction Id used to ensure remote functions are not called multiple times.
TransactionModeDetermines whether remote functions can be called multiple times without affecting the state of the SAP database, or if the transaction must only be executed once.

Method List


The following is the full list of the methods of the class with short descriptions. Click on the links for further details.

AbortConnectionUsed to terminate a connection to the SAP system.
CallFunctionCalls a remote function located on the SAP system.
CloseConnectionCloses a connection to the SAP system.
ConfigSets or retrieves a configuration setting .
CreateIdCreates a transaction Id which is used to ensure that a transaction is executed only once.
DoEventsProcesses events from the internal message queue.
GetAttributesRetrieves attributes about the SAP system you're currently connected to.
GetFunctionInfoRetrieves the parameters and tables used by a remote function.
GetTableInfoRetrieves the current table's structure definition used by the remote function.
InterruptInterrupt the current method.
OpenConnectionOpens a connection to the SAP system.
ResetResets the component to its initial state.
SetRequestParamShortcut to easily set a request parameter's value.

Event List


The following is the full list of the events fired by the class with short descriptions. Click on the links for further details.

ErrorInformation about errors during data delivery.
SSLServerAuthenticationFired after the server presents its certificate to the client.
SSLStatusShows the progress of the secure connection.
StatusDetailed status messages for debugging purposes.
TableRowThis event fires for each row received in a table.

Configuration Settings


The following is a list of configuration settings for the class with short descriptions. Click on the links for further details.

LogPerformanceDataLogs the performance information when a function is called.
LogRawDataLogs the raw data being sent and received.
ParseTablesIndicates whether to parse tables into rows and columns.
ResponseParamText[i]The value of the PARAMTEXT for the specified reponse parameter.
RequestParamText[i]The value of the PARAMTEXT for the specified request parameter.
GroupThe logon group.
MessageServerService name of load balancer service.
SncLibPathThe external security product's library.
SncModeThe SNC activation indicator.
SncNameThe Initiator's SNC name.
SncPartnerNameThe communication partner's SNC name.
SncQopThe quality of protection level.
SystemIDThe system ID of the SAP system.
LocalHostThe IP address of the local interface.
ProxyAutoDetectWhether or not to automatically detect and use proxy system settings, if available.
ProxyAuthorizationThe authorization string to be sent to the proxy server.
ProxyAuthSchemeThe authorization scheme to be used for the proxy.
ProxyPasswordA password if authentication is to be used for the proxy.
ProxyPortPort for the proxy server (default 80).
ProxyServerName or IP address of a proxy server (optional).
ProxyUserA user name if authentication is to be used for the proxy.
FirewallAutoDetectTells the component whether or not to automatically detect and use firewall system settings, if available.
FirewallHostName or IP address of firewall (optional).
FirewallPasswordPassword to be used if authentication is to be used when connecting through the firewall.
FirewallPortThe TCP port for the FirewallHost;.
FirewallUserA user name if authentication is to be used connecting through a firewall.
FirewallTypeDetermines the type of firewall to connect through.
CodePageThe system code page used for Unicode to Multibyte translations.

 
 
Copyright (c) 2017 /n software inc. - All rights reserved.
Build 2.0.6240.0