Tivoli Directory Integrator, Version 7.1.1

SAP ABAP Application Server Function Component

This chapter describes the IBM® Tivoli® Directory Integrator Function Component for SAP ABAP Application Server.

This chapter includes the following sections:

Function Component Introduction

The Function Component for SAP ABAP Application Server uses SAP JCo to invoke RFCs on the SAP ABAP Application Server System. The Function Component provides a means of calling an arbitrary RFC.

Figure 1 below illustrates the overview architecture of the RFC Function Component.

Figure 9. Overview architecture of the RFC Function Component
Diagram shows component flow and architecture of SAP ABAP Application Server and the RFC Function Component

Before using the Function Component for SAP ABAP Application Server, the SAP JCo must be downloaded and installed (for details, see Software Requirements).

Configuration

If the Function Component for SAP ABAP Application Server (SAP ABAP AS) is added directly into an assembly line, the following configuration parameters are available for client connections. The parameters are very similar to the logon parameters for the traditional SAP GUI. Runtime names are shown below in parentheses.

Parameters

ABAP AS Client (client)
SAP ABAP AS Logon client for SAP connection. For example, 100.
ABAP AS User (user)
SAP ABAP AS Logon user for SAP connection.
Password (passwd)
SAP ABAP AS Logon password for SAP connection.
ABAP AS System Number (sysnr)
The SAP ABAP AS system number for SAP connection. For example, 00.
ABAP AS Hostname (ashost)
SAP ABAP AS application server name for SAP connection.
Gateway host (gwhost)
Gateway host name for SAP connection.
RFC Trace (trace)
Set to one (1) to enable RFC API tracing. If enabled, the SAP RFC API will produce separate rfc_nnnn.trc files (where nnnn represents values assigned by the RFC API) in the working directory IBM Tivoli Directory Integrator This option may be useful to help diagnose RFC invocation problems. It logs the activity and data between the Connector and SAP ABAP AS. This should be set to zero (0) for production deployment.

Additional configuration parameters are available when using the Function Component programmatically. For more information on the additional parameters, see the SapR3RfcFC Java Doc in the distribution package.

Function Component Input

The perform() method accepts an Entry object. If anything else is passed an Exception is thrown. The Entry object contains two attributes:

The Function Component supports three styles of invocation:

The value of requestType should be set to one of the following, to indicate which style is to be used:

The value of attribute request is a type of:

The value of request represents the request data of an RFC as one of:

Any other value will result in an Exception being thrown.

If request is of type org.w3c.dom.Document:
Its associated value must be an org.w3c.dom.Document containing an XSchema that conforms to the specification for ABAP RFC XML serialization.
If request is of type java.lang.String:
Its associated value must be an XML string. A DOM parser will parse the string value. Its XSchema must also conform to the specification for Serialization of ABAP Data in XML.
If request is a multi-valued attribute:
The first value of attribute request must be of type java.lang.String, containing the name of the RFC, while the second value of the attribute request must be com.ibm.di.entry.Attribute, whose values contain additional attributes for the SAP RFC parameters as a series of nested and multi-valued attributes representing the names of the import and table parameters of the RFC. The names of the parameters must be encoded according to the rules for Serialization of ABAP Data in XML (names will not have characters that could result in badly-formed XML).

Here is an example of how to invoke the Function Component using the multi-valued attributes style:

		 		 var rfc = system.newAttribute("BAPI_SALESORDER_GETLIST");
		 		 var attr1 = system.newAttribute("CUSTOMER_NUMBER");
		 		 attr1.addValue("0000000016");
		 		 var attr2 = system.newAttribute("SALES_ORGANIZATION");
		 		 attr2.addValue("AU01");
		 		 rfc.addValue(attr1);
		 		 rfc.addValue(attr2);
		 		 var entry = system.newEntry(); 
		 		 var reqAttr = entry.newAttribute("request");
		 		 reqAttr.addValue(rfc);
		 		 entry.setAttribute("requestType", "multiValuedAttributes");
		 		 var result = fc.perform(entry); 

Function Component Output

The Function Component output is an Entry object with two attributes:

Attribute responseType will have a java.lang.String value corresponding to the input request type.

If the Entry contains an attribute responseType with value xmlDomDocument
The value of attribute response is an org.w3c.dom.Document containing the RFC response.
If the Entry contains an attribute responseType with value xmlString
The value of attribute response is an XML java.lang.String containing the RFC response.
If the Entry contains an attribute responseType with value multiValuedAttributes
The value of attribute response is a nested and multi-valued attribute, where the first value is a java.lang.String, which has the name of the RFC that was invoked, and the second value contains the results of the RFC as a series of nested multi-valued attributes.

Using the Function Component

The Function Component invokes the given RFC for a SAP ABAP Application Server system.

It can be placed in an assembly line or invoked directly from script. It is the callers' responsibility to check the returned Entry object for any errors that may have resulted from invoking the RFC.

As an example, the following code can be used to invoke an RFC from JavaScript:

var counter = 0;
var fc = system.getFunction("ibmdi.SapR3RfcFC");
var myentry;
var docResponse;

fc.setParam(fc.PARAM_CONFIG_CLIENT, "100");
fc.setParam(fc.PARAM_CONFIG_USER, "TIVOLI");
fc.setParam(fc.PARAM_CONFIG_PASSWORD, "******");
fc.setParam(fc.PARAM_CONFIG_SYSNUMBER, "11");
fc.setParam(fc.PARAM_CONFIG_LANGUAGE, "E");
fc.setParam(fc.PARAM_CONFIG_APPLICATION_SERVER, "kimala");

fc.initialize(null);
var rfc = new java.lang.String("<BAPI_COMPANYCODE_GETLIST/>");
var myentry = system.newEntry();
var attr = myentry.newAttribute(fc.PARAM_INPUT_TYPE);
attr.addValue(fc.PARAM_VAL_STRING);

attr = myentry.newAttribute(fc.PARAM_INPUT);
attr.addValue(rfc);
var myresponse = fc.perform(myentry);

//system.dumpEntry(myresponse);
fc.terminate();
Note:
Configuration parameters must be set before initialize() is called, and terminate() should be called to cleanup.

Using the Command Line RFC Invoker

As a tool to assist in creating valid RFC XML requests, a command line utility has been provided. It can be invoked outside of the IBM Tivoli Directory Integrator environment and is able to read an XML file, which represents an RFC XML request to be executed against the SAP ABAP Application Server system.

To invoke the utility, first add the following jars to the CLASSPATH environment variable:

Then, invoke using the command:

TDI_install_dir/jvm/bin/java com.ibm.di.fc.sapr3rfc.RfcXmlInvoker -f 
   [input XML file] -o [output XML file] -p 
   [JCO Connection properties file]
Notes:
  1. These instructions assume that you have already completed the steps described in Configuring the SAP Java Connector. It is important that the sapjco.jar is in the CLASSPATH, and that sapjcorfc.{dll/so} and librfc*.{dll/so} are in the loadable library path.
  2. For AIX, the path to the Java executable is TDI_install_dir/jvm/jre/bin/java.exe

The contents of the JCO Properties file represent the SAP ABAP AS client connection parameters for the SAP system. An example of the values in the property file is shown below:

jco.client.client=R/3 CLIENT
jco.client.user=R/3 USER NAME
jco.client.passwd=R/3 USER PASSWORD
jco.client.sysnr=R/3 SYSTEM NUMBER
jco.client.ashost=R/3 APPLICATION SERVER HOSTNAME OR IP ADDRESS
jco.client.trace=RFC API TRACE: 1 = ON; 0 = OFF
[ Top of Page | Previous Page | Next Page | Contents | Terms of use | Feedback ]
(C) Copyright IBM Corporation, 2003, 2012. All Rights Reserved.
IBM Tivoli Directory Integrator 7.1.1