Server Sample Programs: Srfctest and SrfctestAuto 

The RFC Java Class Library development kit provides two sample programs to demonstrate how to construct and use the com.sap.rfc.IServerFunction and com.sap.rfc.IServerProcess objects:

Sample Program

Method of Constructing Function Objects

Srfctest

manual creation

SrfctestAuto

automatic creation

Each of these programs offers the following two RFC functions:

These two functions work with the R/3 program SRFCTEST. SRFCTEST includes many options, two of which can make client calls to our sample application programs: Connection can call STFC_CONNECTION and Performance can call STFC_PERFORMANCE.

STFC_CONNECTION

STFC_CONNECTION is implemented using the class StfcConnection.

This function receives a simple parameter of type CHAR and echoes this parameter. It then returns another simple parameter of its own, of type CHAR.

STFC_PERFORMANCE

STFC_PERFORMANCE is implemented by the class StfcPerformance.

This function tests the performance of a predefined set of operations.

STFC_PERFORMANCE receives two table parameters and returns two table parameters.

Received Table Parameters

Parameter

Type

ITAB0332

H332

ITAB1000

H1000

Returned Table Parameter

Parameter

Type

ETAB0332

H332

ETAB1000

H1000

The STFC_PERFORMANCE function receives four simple parameters of type NUMC (numeric character):

Table Parameter

Expected No. of Rows From R/3

LGIT0332

ITAB0332

LGIT1000

ITAB1000

LGET0332

ETAB0332

LGET1000

ETAB1000

The STFC_PERFORMANCE function returns a single-character code, EXITCODE. When its value is O (the letter "O"), the function call was successful. When its value is E , the function encountered an error during processing. This function performs the following processing:

  1. The STFC_PERFORMANCE function checks the expected number of rows of ITAB0332 against the received number of rows of that table parameter, and then it does the same with ITAB1000. When there is error, it returns E for EXITCODE.
  2. Next, the STFC_PERFORMANCE function appends the expected number of table rows to ETAB0332, as indicated by LGET0332. In each row, a header indicates the row number. The rest of the row is filled with a numeric digit.
  3. Then, the STFC_PERFORMANCE function appends the expected number of table rows to ETAB1000, as indicated by LGET1000. In each row, a header indicates the row number. The rest of the row is filled with a numeric digit.

Testing the Programs

To run the Srfctest or the SrfctestAuto programs as a server application:

  1. Supply an RFC destination on the command line when invoking the program (see Registering a Server Application at the SAP Gateway for setting up RFC destinations).
  2. Log onto the R/3 System where the RFC destination is defined.
  3. Use Transaction SE38, and enter the program name: SRFCTEST.
  4. Choose either Performance or Connection to test the applicable function in Srfctest or SrfctestAuto.
  5. Enter the RFC destination used by your server application.