Server Programming with Automatic Creation of Function Objects 

Use

When creating server applications with the Java RFC Class Library you can let the Java RFC Class Library automatically create the parameter objects for the RFC functions you offer in your application.

Letting the Java RFC Class Library automatically create server function objects eliminates the tasks of creating and adding the parameter objects to the server function objects, as done with manual creation of these parameters.

Prerequisites

You do so by using the Function Builder (Transaction SE37) in the calling R/3 system.

Once you define the signatures of your function in the R/3 system, the Java RFC Class Library can obtain the function's metadata for the purpose of automatic creation of your server function and parameter objects.

Procedure

 

Task Description

1.

Obtain a single instance of SessionManager.

See Obtaining SessionManager for more details and an example.

2.

Obtain a single instance of ServerApp.

See Obtaining the ServerApp Object for more information.

3.

Use the SessionManager to create an IServerFunctionFactory object.

See Using the IServerFunctionFactory Object for more information.

Perform the following steps for every RFC function that you intend to offer in your application:

 

4.

Use the IServerFunctionFactory to create an IServerFunction object representing the RFC function. Call the IServerFunctionFactory.createCompleteServerFunction() to create all the necessary function objects automatically.

See Using the IServerFunctionFactory Object for more information.

5.

Create a server process class that implements the IServerProcess interface. This class implements the process() method of the IServerProcess interface.

This process() method is where you implement the processing logic of the RFC function you intend to offer. The processing logic manipulates the import data received from an incoming call, and generates export data for returning information to the calling client.

See Creating a Server Process for Incoming Calls for more information.

6.

Instantiate a server process object belonging to your new server process class.

7.

Call IServerFunction.setServerProcess(IServerProcess) to store the reference of your server process object in your server function object.

See Associating IServerFunction and IServerProcess for more information.

8.

Call ServerApp.addServerFunction(IServerFunction) to add the newly created and configured IServerFunction object to the single instance of ServerApp you have obtained in step (2).

See Adding IServerFunction to ServerApp for more information.

9.

Call the ServerApp.setAcceptArgs method to set the RFC destination where the server application is to be registered.

See Registering a Server Application at the SAP Gateway for more information.

10.

Adjust the number of threads for processing incoming RFC calls.

See Adjusting the Number of Server Threads for more information.

11.

Call ServerApp.run() to wait for incoming RFC calls and process these calls. See Running a Server Application for more information.

Result

You server application is ready to accept RFC calls from an R/3 system.