This section provides an example of how you can establish a server-side RFC connection that originates from the SAP system.
To send 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:
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
CALL FUNCTION 'STFC_CONNECTION' DESTINATION RFCDEST EXPORTING REQUTEXT = REQUTEXT IMPORTING RESPTEXT = RESPTEXT ECHOTEXT = ECHOTEXT EXCEPTIONS SYSTEM_FAILURE = 1 MESSAGE RFC_MESS COMMUNICATION_FAILURE = 2 MESSAGE RFC_MESS.
IF SY-SUBRC NE 0. WRITE: / 'Call STFC_CONNECTION SY-SUBRC = ', SY-SUBRC. WRITE: / RFC_MESS. ENDIF.
|