Tecnologia
The following section explains how you can write your own JCo programs for servers if you use the standalone version of the SAP JCo.
A JCo server program implements functions that are called up by an RFC client. The JCo server program is registered via the SAP Gateway and waits for inbound RFC calls.
• An RFC server program registers itself under aprogram ID to an SAP gateway (not for a specific SAP system).
• If an RFC call is passed on from any SAP system to this SAP gateway with the option “Connection with a registered program” (with the same program ID), the connection takes place with the corresponding JCo server program.
• Once an RFC function has been executed, the JCo Server waits for further RFC calls from the same orother SAP systems.
• If an RFC connection is interrupted or terminated, the JCo server automatically registers itself again on the same SAP gateway under the same program ID.
Prerequisites
• You are using the standalone version of the SAP JCo.
• Using transaction SM59, you have defined a destination with connection type T (TCP/IP connection) in the SAP system.
• You have chosen the registration mode (“Registered server program” option under the “Technical settings” tab page) for this destination.
• The destination contains the required information about the SAP gateway and the registered RFC server program.
Additional Information
The following sections provide examples of how to program various JCo server functions:
• Establishing anRDC Connection (Inbound Call from the SAP System)
• Java Program for Establishing a Server Connection
• Exception Listener
• Server State Change Listener
• Processing an ABAP Call
Inbound RFC Connection (from the SAP System) [pic]
This section provides an example of how you can establish a server-side RFC connection that originates from the SAP system.
Tosend a call from an ABAP system, the ABAP program uses the option DESTINATION "NAME" for the command CALL FUNCTION.
In transaction SE38, create a report with the following coding:
[pic]
| |
|DATA: REQUTEXT LIKE SY-LISEL,|
| RESPTEXT LIKE SY-LISEL, |
| ECHOTEXT LIKE SY-LISEL. |
| |
|DATA: RFCDEST like rfcdes-rfcdest VALUE 'NONE'. |
|DATA: RFC_MESS(128). |
| |
|REQUTEXT = 'HELLO WORLD'. |
|RFCDEST = 'JCOSERVER01'. "corresponds to the destination name defined in the SM59 |
| |
|CALLFUNCTION 'STFC_CONNECTION' |
| DESTINATION RFCDEST |
| EXPORTING |
| REQUTEXT = REQUTEXT...
Regístrate para leer el documento completo.