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

SapQuery Component

Properties   Methods   Events   Configuration Settings   Errors  

The SapQuery provides an easy way to execute queries on a remote R/3 (NetWeaver) system.

Syntax

TibiSapQuery

Remarks

The purpose of this component is to make executing a query on a SAP server extremely simple.

There are just a few steps you need to make before you can begin executing a query: first you set your connection credentials and connect to the SAP system (see Setting Up a Connection with a SAP System for details). Next set the QueryName as well as the UserGroup and WorkSpace and then call GetQueryInfo to populate the QueryFields and Selection Parameters. Once populated, you can then set the Selection Parameters and QueryFields you want and then call ExecuteQuery. This will populate the Query Result Rows, and the QueryResultRowIndex and QueryResultColumns can be used to access the results.

The following example shows how to execute a query 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.

Now we need to specify the query we want to execute and get the information about the query from the SAP system using the method GetQueryInfo.

SapQuery1.UserGroup = "/SAPQUERY/QD";
SapQuery1.QueryName = "CONNECTIONS_02";
SapQuery1.WorkSpace = SapqueryWorkSpaces.wsGlobalArea;
SapQuery1.GetQueryInfo();
Now that you have retrieved the structure of the query, you may set the Selection Parameters as you see fit and then call ExecuteQuery.
SapQuery1.MaxRows = 100;
SapQuery1.SelectionParameterIndex = 0;
SapQuery1.SelectionParameterRanges.Add(new QueryRange("NW", "AC", RangeOptions.roBetween, Signs.snInclude));
SapQuery1.ExecuteQuery();
The results of executing the query "CONNECTIONS_02" are now contained in the Query Result Rows starting at QueryResultRowIndex 0, and may be accessed like this:
for (int i = 0; i < query.QueryResultRowCount; ++i) {
  SapQuery1.QueryResultRowIndex = i;
  foreach (SapColumn col in SapQuery1.QueryResultColumns) {
    Console.Write("{0}\t", col.Value);
  }
  Console.WriteLine();
}
The above code will output something very similar to this:

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 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 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.
MaxRowsMax number of rows in the query result.
QueryFieldCountThe number of records in the QueryField arrays.
QueryFieldDecimalsThe decimal value of query result property.
QueryFieldDescriptionThe description of query result property.
QueryFieldLengthThe length of the data in the query result property.
QueryFieldNameThe name of query result property.
QueryFieldTypeThe ABAP type of query result property.
QueryMetaDataCountThe number of records in the QueryMetaData arrays.
QueryMetaDataQueryNameThe name of query retrieved from the SAP server.
QueryMetaDataUserGroupThe user group retrieved from the SAP server.
QueryMetaDataVariantThe variant value of the query retrieved from the SAP server.
QueryNameThe name of the query.
QueryResultColumnCountThe number of records in the QueryResultColumn arrays.
QueryResultColumnTypeThe type of the column.
QueryResultColumnLengthThe maximum length of the data stored in Value .
QueryResultColumnNameThe name of the column.
QueryResultColumnTableIndexThis should be set if the ColumnType is set to ctTable.
QueryResultColumnValueThis is the actual data contained in the column.
QueryResultRowCountThe number of rows returned.
QueryResultRowDataThe raw binary data of the current row.
QueryResultRowIndexThe index of the current row in the query results.
QueryUserGroupsThe user groups for the query.
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.
SelectionParameterCountThe number of the selection parameters.
SelectionParameterDataTypeThe data type of the current selection parameter.
SelectionParameterDescriptionThe description of the current selection parameter.
SelectionParameterFieldNameThe field name of the current selection parameter.
SelectionParameterIndexThe index of the current selection parameter.
SelectionParameterLengthThe length of the current selection parameter.
SelectionParameterNameThe name of the current selection parameter.
SelectionParameterRangeCountThe number of records in the SelectionParameterRange arrays.
SelectionParameterRangeHighValueThe high value of the query range.
SelectionParameterRangeLowValueThe low value of the query range.
SelectionParameterRangeOptionThe valid range options are as follows: roEquals (0)\011\011\011\011\011\011\011\011 Equal to roNotEquals (1)\011\011\011\011\011\011\011 Not equal to roGreaterThan (2)\011\011\011\011\011\011 Greater than roLessThan (2)\011\011\011\011\011\011\011 Less than roGreaterThanOrEqualTo (4) \011 Greater than or equal to roLessThanOrEqualTo (5)\011\011\011 Less than or equal to roBetween (6)\011\011\011\011\011\011\011\011 Between roNotBetween (7)\011\011\011\011\011\011 Not between roMatchesPattern (8)\011\011\011\011 Matches pattern roNotMatchesPattern (9)\011\011\011 Does not match pattern .
SelectionParameterRangeSignThe sign of query range.
SelectionParameterTypeThe kind of the current selection parameter.
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).
TimeoutLength of time in seconds the component waits for a response from the SAP system.
UserGroupThe name of the user group.
VariantVariant value of the Query.
WorkSpaceWork Area of the Query.

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.
ExecuteQueryExecute the query.
GetAttributesRetrieves attributes about the SAP system you're currently connected to.
GetQueryInfoGet Query information.
InterruptInterrupt the current method.
OpenConnectionOpens a connection to the SAP system.
ResetResets the component to its initial state.
RetrieveQueriesRetrieves queries from the user group.
RetrieveUserGroupsRetrieves user groups.

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.

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