This chapter describes the IBM TDI Function Component for SAP ABAP Application Server.
This chapter includes the following sections:
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.
Overview architecture of 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).
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.
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.
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.
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);
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.
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();
Configuration parameters must be set before initialize() is called, and terminate() should be called to cleanup.
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 TDI 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:
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