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

SapReadTable Component

Properties   Methods   Events   Configuration Settings   Errors  

The SapReadTable provides an easy way to read a table hosted on a remote R/3 (NetWeaver) system.

Syntax

nsoftware.InERP.Sapreadtable

Remarks

The purpose of this component is to make reading a table that is hosted on a SAP server extremely simple.

There are just a few steps you need to make before you can begin reading tables: First you set your connection credentials and connect to the SAP system (see Setting Up a Connection with a SAP System for details). Then you will need to retrieve the table fields by calling QueryTableFields. Then set the QueryFields with the fields that you would like to query and the QueryOptions with any options you would like to set. Then call ReadTable and after the method successfully returns, ResultRowCount ResultRowData, and ResultColumns will be populated.

The following example shows how to read a table hosted on the SAP server. First we provide login credentials and connect.

  SapClient1.SapConnection.ConnectionType = ConnectionTypes.ctNetWeaver;
  SapClient1.SapConnection.Client = "000";
  SapClient1.SapConnection.Destination = "";
  SapClient1.SapConnection.Host = "localhost";
  SapClient1.SapConnection.User = "BCUSER";
  SapClient1.SapConnection.Password = "minisap";
  SapClient1.SapConnection.SystemNumber = 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.

Now you will need to provide the TableName that you wish read and then call QueryTableFields.

  readTable.TableName = "ZCARS";
  readTable.QueryTableFields();
  Console.WriteLine("Name \tLength \tColumnType \tValue");
  for (int i = 0; i < readTable.TableFields.Count; ++i)
  {
    SapColumn col = readTable.TableFields[i];
    if (col.ColumnType == ColumnTypes.ctPackedDecimal)
      Console.WriteLine(col.Name + "\t" + col.Length + "\t" + col.ColumnType + "\t" + readTable.Config("TableFieldDecimal=" + i));
    else
      Console.WriteLine(col.Name + "\t" + col.Length + "\t" + col.ColumnType + "\t" + col.Value);
  }
After you have the TableFields you will need to select which fields you would like to query as well as select any additional options you would like to use before reading the table.
  readTable.QueryFields = "CLIENT,CATEGORY";
  readTable.QueryOptions = "CLIENT = '000' ,AND CATEGORY = 'A'";
  readTable.ReadTable();
To read the you would need to do something like this:
  for (int i = 0; i < readTable.ResultRowCount; ++i)
  {
    readTable.ResultRowIndex = i;
    for (int j = 0; j < readTable.ResultColumns.Count; ++j)
    {
      SapColumn col = readTable.ResultColumns[j];
      Console.Write(col.Value + "\t");
    }
    Console.WriteLine();
  }
The above code will output something very similar to this:
000	A	
000	A	
000	A	

Dependency Notes

If the component 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 ConnectionType 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 ConnectionType 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 ConnectionType 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 ConnectionType 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 components. 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 component with short descriptions. Click on the links for further details.

ConnectedIndicates whether or not the component is connected to the SAP system.
MaxRowsThe maximum number of rows.
QueryFieldsThe fields to be queried.
QueryOptionsSelection criteria for reading table lines.
ResultColumnsContains a list of the columns that make up each row.
ResultRowCountThe total number of rows retrieved.
ResultRowDataThe raw binary data that makes up a row.
ResultRowIndexThe index of the current row.
RowOffsetThe number of rows to be offset.
SapAttributesDescribes the SAP R/3 system you're connected to.
SapConnectionThese properties are used to connect to the SAP system.
SSLAcceptServerCertInstructs the component to unconditionally accept the server certificate that matches the supplied certificate.
SSLCertThe certificate to be used during SSL negotiation.
SSLServerCertThe server certificate for the last established connection.
TableFieldsContains a list of the fields in a table.
TableNameThe name of the table you wish to query.
TimeoutLength of time in seconds the component waits for a response from the SAP system.

Method List


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

AbortConnectionUsed to terminate a connection to the SAP system.
CloseConnectionCloses a connection to the SAP system.
ConfigSets or retrieves a configuration setting .
DoEventsProcesses events from the internal message queue.
GetAttributesRetrieves attributes about the SAP system you're currently connected to.
InterruptInterrupt the current method.
OpenConnectionOpens a connection to the SAP system.
QueryTableFieldsRetrieves all fields meta data for a table.
ReadTableRetrieves the table data.
ResetResets the component to its initial state.

Event List


The following is the full list of the events fired by the component 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.

Configuration Settings


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

TableFieldDecimalDecimal value of table field.
CustomReadTableFunctionCustom ReadTable function.
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