JCo RFC Provider Service

Use

The RFC is an SAP interface protocol, which simplifies the programming of communication processes between systems. The RFCs enable you to call and execute predefined functions in a remote system, or in the same system. The RFCs manage the communication process, parameter transfer, and error handling.

In the AS Java the RFC functions are implemented by the RFC Engine service, which is presented in the SAP NetWeaver Administrator under the name JCo RFC Destinations. This service is used for processing ABAP to Java requests. A feature is provided for receiving calls from the SAP systems - this is done by registering the AS Java as an RFC destination.

The RFC Engine service processes calls from the SAP systems. It dispatches the calls to a stateless session bean, which is registered in the AS Java naming system. By naming convention the JNDI name used is identical to the name of the SAP function module.

Technically, the service is based on the JCo (SAP Java Connector).

Integration

This section explains how the RFC Engine works within the AS Java environment.

RFC Scenario

  1. On startup the RFC Engine serviceconnects to the Web AS repository.
  2. On startup the RFC Engine serviceregisters itself at the Gateway with a defined name. It is possible to register it under different names and at different Gateways.
  3. The Web AS calls a function for the registered RFC destination.
  4. The Gateway forwards the call to the RFC Engine service.
  5. The RFC Engine servicelooks in the JNDI for the EJB, which is registered under the function name.
  6. The RFC Engine servicecalls the processFunction(JCO.Function) method of the EJB found.
  7. The results of that call (the modified JCO.Function ) are passed to the Gateway.
  8. The Gateway passes the results back to the Web AS.

Features

The RFC Engine service uses a TCP/IP connection type. Hence, the destination must be created in the Web AS with a gateway host and gateway service for the particular system. Then, on the AS Java, the same destination with the same name, host, and service is created.

You then have to write a bean with a method having signature public void processFunction(com.sap.mw.jco.JCO.Function function)throws java.lang.Exception.

You also have to define a local interfaces for this bean having the same method signature.

The bean should contain AS Java specific descriptor defining for what Function Module this bean can be called.

If you define an EJB STFC _CONNECTIONBean that should be called for the FunctionModule STFC _CONNECTION , the descriptor ejb-j2ee-engine.xml having the following content should be added:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE ejb-j2ee-engine SYSTEM "ejb-j2ee-engine.dtd">
<ejb-j2ee-engine>
   <enterprise-beans>
      <enterprise-bean>
         <ejb-name>STFC_CONNECTIONBean</ejb-name>
         <jndi-name>STFC_CONNECTION</jndi-name>
         <session-props/>
      </enterprise-bean>
   </enterprise-beans>
</ejb-j2ee-engine>

After this bean is deployed it can be called from the back-end.

Security

The RFC Engine service supports SSO Tickets. That is, if in the ABAP environment the corresponding RFC destination is configured to send a SSO Ticket, during a Function Call "ABAP-J2EE Engine" this SSO ticket will be received. This will activate the process of authorizing the user.

The service also provides you the possibility to define particular RFC destinations to use Secure Network Connection (SNC).