JCO RFC Provider
Siddhartha Bhattacharya
JCO RFC Provider : Overview
Contents:
Contents
z JCO RFC Provider Service
z Visual Administrator Configuration
z Calling J2EE from SAP R/3
© SAP AG 2004 / Siddhartha Bhattacharya / JCO RFC Provider
JCO RFC Provider : Unit Objectives
After completing this unit, you will be able to:
z Understand the JCO RFC Provider Service
z Configure JCO RFC Provider Service
z Make an outbound call from SAP R/3 to J2EE
© SAP AG 2004 / Siddhartha Bhattacharya / JCO RFC Provider
JCO RFC Provider: Topic Objectives
After completing this session, you will be able to:
z Understand the JCO RFC Provider Service
© SAP AG 2004 / Siddhartha Bhattacharya / JCO RFC Provider
JCO RFC Provider Service
© SAP AG 2004 / Siddhartha Bhattacharya / JCO RFC Provider
JCO RFC Provider Service
What is the JCO RFC Provider Service?
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.
In the SAP J2EE Engine the RFC functions are
implemented by the JCO RFC Provider Service, which 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 J2EE Engine as a
RFC destination
© SAP AG 2004 / Siddhartha Bhattacharya / JCO RFC Provider
JCO RFC Provider Service
Features
The JCO RFC Provider Service offers two types of
connection –
Through a TCP/IP
Through a shared memory
You can choose the connection type using the Use profile
indicator from the JCO RFC Provider Service Runtime tab
in the J2EE Engine Visual Administrator
© SAP AG 2004 / Siddhartha Bhattacharya / JCO RFC Provider
JCO RFC Provider : Topic Summary
You should now be able to:
z Understand the JCO RFC Provider Service
© SAP AG 2004 / Siddhartha Bhattacharya / JCO RFC Provider
JCO RFC Provider: Topic Objectives
After completing the next session, you will be able to:
z Configure JCO RFC Provider Service
© SAP AG 2004 / Siddhartha Bhattacharya / JCO RFC Provider
JCO RFC Provider : Visual Administrator
SAP R/3
Program ID
This is the Program ID with
which the Server registers
itself with the SAP R/3
system.
© SAP AG 2004 / Siddhartha Bhattacharya / JCO RFC Provider
The Program ID must be defined as a destination in SAP R/3 using transaction SM59.
When the Available RFC Destination is started it registers itself with the SAP R/3 system.
JCO RFC Provider : Program ID registration
SMGW Transaction
J2EE Program
registered.
© SAP AG 2004 / Siddhartha Bhattacharya / JCO RFC Provider
If the program is successfully registered the connection can be viewed in transaction smgw
JCO RFC Provider : SAP R/3
SM59 Transaction
RFC Destination name
SAP R/3
Program ID
© SAP AG 2004 / Siddhartha Bhattacharya / JCO RFC Provider
This destination can be used to invoke functions remotely from SAP R/3 function modules.
The RFC Destination name will be used by ABAP code to make remote calls.
JCO RFC Provider : SAP R/3
Making a remote call from ABAP
RFC Destination Name
© SAP AG 2004 / Siddhartha Bhattacharya / JCO RFC Provider
This destination can be used to invoke functions remotely from SAP R/3 function modules.
JCO RFC Provider : Topic Summary
You should now be able to:
z Configure JCO RFC Provider Service
© SAP AG 2004 / Siddhartha Bhattacharya / JCO RFC Provider
JCO RFC Provider: Topic Objectives
After completing the next session, you will be able to:
z Make an outbound call from SAP R/3 to J2EE
© SAP AG 2004 / Siddhartha Bhattacharya / JCO RFC Provider
JCO RFC Provider Service : Programming
Steps involved
1. On startup the JCo RFC Provider Service connects to
the Web AS repository.
2. On startup the JCo RFC Provider Service registers
itself at the Gateway with a defined name.
3. The Web AS calls a function for the registered RFC
destination.
4. The Gateway forwards the call to the JCo RFC
Provider Service.
© SAP AG 2004 / Siddhartha Bhattacharya / JCO RFC Provider
JCO RFC Provider Service : Programming
Steps involved
5. The JCo RFC Provider Service looks in the JNDI for the
EJB, which is registered under the function name.
The name of the function must be identical with the
JNDI name of the bean, that is, it is necessary to have a
JNDI name.
6. The JCo RFC Provider Service calls the
processFunction(JCO.Function) method of the EJB
found.
7. The results of that call are passed to the Gateway.
8. The Gateway passes the results back to the Web AS.
© SAP AG 2004 / Siddhartha Bhattacharya / JCO RFC Provider
JCO RFC Provider : Programming
Implement processFunction() business method
Assume the Stateless Session Bean is already created. Import the project in
your workspace and add the following code in the ‘processFunction’ business
method
// Get the import parameters for the function module
JCO.ParameterList importList = function.getImportParameterList();
logger.infoT("The value sent from SAP for UNAME is " +
(String)importList.getValue("UNAME"));
// Set the export parameter value for the function module
JCO.ParameterList export = function.getExportParameterList();
export.setValue(“From EJB", "RETURN");
function.setExportParameterList(export);
© SAP AG 2004 / Siddhartha Bhattacharya / JCO RFC Provider
JCO RFC Provider : Programming
Provide a JNDI Name
The JNDI Name of the stateless session bean should be the same as the
calling function module in SAP R/3. Switch to the j2ee-engine.xml tab and
make sure the JNDI name is defined correctly.
© SAP AG 2004 / Siddhartha Bhattacharya / JCO RFC Provider
JCO RFC Provider : Programming
Include JCO and Logging libraries in the EJB Project
The JCO and Logging libraries should be included in the Project Build Path of
the EJB Project.
© SAP AG 2004 / Siddhartha Bhattacharya / JCO RFC Provider
JCO RFC Provider : Programming
Include JCO and Logging libraries in EAR
The JCO and Logging libraries should be included as a weak reference in the
EAR Project. Open application-j2ee-engine.xml file from the EAR project.
Switch to the General tab and add the com.sap.mw.jco and
com.sap.tc.Logging References.
© SAP AG 2004 / Siddhartha Bhattacharya / JCO RFC Provider
JCO RFC Provider : Programming
Function Module Z_JCO_RFC_PROVIDER
The function module Z_JCO_RFC_PROVIDER is defined in ABAP. Use
Transaction SE37 to view it. This function module will call the Stateless
Session Bean’s business method.
© SAP AG 2004 / Siddhartha Bhattacharya / JCO RFC Provider
This destination can be used to invoke functions remotely from SAP R/3 function modules.
JCO RFC Provider : Testing the program
Execute Function Module Z_JCO_RFC_PROVIDER
Populate the import parameter UNAME of the function module
Z_JCO_RFC_PROVIDER and execute it. Provide the
© SAP AG 2004 / Siddhartha Bhattacharya / JCO RFC Provider
This destination can be used to invoke functions remotely from SAP R/3 function modules.
JCO RFC Provider : Topic Summary
You should now be able to:
z Make an outbound call from SAP R/3 to J2EE
© SAP AG 2004 / Siddhartha Bhattacharya / JCO RFC Provider
JCO RFC Provider : Unit Summary
You should now be able to:
z Understand the JCO RFC Provider Service
z Configure JCO RFC Provider Service
z Make an outbound call from SAP R/3 to J2EE
© SAP AG 2004 / Siddhartha Bhattacharya / JCO RFC Provider