Show TOC Start of Content Area

Background documentation Programming Model  Locate the document in its SAP Library structure

RFC Interfaces and Java Proxy

An RFC interface defines the name; the parameters (importing, exporting, changing, and table); and the exceptions of an RFC function module. Parameters can refer to data types in the ABAP Dictionary. The individual parameters or data elements of a ABAP Dictionary data type are declared as attributes of the generated Java classes. The SAP Enterprise Connector brings all the generated type classes and the Java Proxy together in one or two packages (you specify the name of the first package during generation, the second has the same name with an additional .util ). Type-secure getter and setter methods are defined for each attribute of a generated class, for example getAirline()and setAirline().

This graphic is explained in the accompanying text

For example, the function module BAPI_FLIGHT_GETLIST looks like this in the Package Explorer:

This graphic is explained in the accompanying text

See Example: Using Generated Proxies to Call Function Modules for simple example using the same function module.

Elementary Data Types

SAP Enterprise Connector maps elementary ABAP data types to primitive Java types or existing Java classes:

ABAP Type     

Java Type / Class

b   

short

C   

java.lang.String

D   

java.sql.Date

F   

double

g   

java.lang.String

I    

int

N   

java.lang.String

P   

java.math.BigDecimal

s   

short

T   

java.sql.Time

X   

byte[]

y   

byte[]

ABAP Dictionary Data Types

Data types in the ABAP Dictionary are program-independent data definitions that can be re-used globally. SAP Enterprise Connector generates an independent Java class for each data type that is referenced by the selected RFC function module.

Data elements of a ABAP Dictionary data type are defined as attributes of the Java class. The getter and setter methods enable read and write access to individual data elements.

Parameters

SAP Enterprise Connector generates an input class that contains all the importing and changing parameters of a function module. In the same way, the tool generates an output class that combines all the exporting, changing, and table parameters. The class names comprise function module names followed by the string _Input or _Output. The individual parameters are defined as class attributes that the calling program can access, to read or write, by using getter and setter methods.

Tables

The table parameters that a RFC function module returns are represented as lists by the Java Proxy. For each return table, the Java Connectivity Builder generates a Java class. These lists are contained in the output class.

The line type of a table corresponds to a ABAP Dictionary data type. Therefore, the SAP Enterprise Connector generates a Java class for the line type.

Exceptions

A generated class, whose name consists of the function module name followed by the string _Fault, contains all the exceptions of the function module. Also generated is a Java exception class that a Java program can catch and handle. This exception class encapsulates the other class, and its name consists of the function module name followed by the string _Fault_Exception.

Example

try {

   Rfc_Get_Function_Interface_Output response =

      proxy.rfc_Get_Function_Interface(request);

} catch (Rfc_Get_Function_Interface_Fault_Exception e) {

   Rfc_Get_Function_Interface_Fault fault =

      (Rfc_Get_Function_Interface_Fault) e.getFault();

   System.out.println("Exception message: " + e.getMessage());

   System.out.println("Fault message name: " + fault.getName());

   System.out.println("Fault message text: " + fault.getText());

} catch (ApplicationFaultException e) {  

} catch (SystemFaultException e) { }

Function Modules

The generated Java proxy class contains all the selected function modules, and these are defined as methods of this class. The class name comprises a name that you enter during generation, and the string _PortType.

Required Packages

From plugins\com.sap.ide.jcb.core\lib\

·        aii_proxy_rt.jar

·        aii_util_misc.jar

·        SAPmdi.jar

From plugins\com.sap.mw.jco\lib\

·        sapjco.jar

 

End of Content Area