Show TOC

Example documentationInbound RFC Connection (from the SAP System) Locate this document in the navigation structure

 

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 system program uses the option DESTINATION "NAME" for the command CALL FUNCTION.

In transaction SE38, create a report with the following coding:

Syntax Syntax

  1. DATA: REQUTEXT LIKE SY-LISEL,
  2.       RESPTEXT LIKE SY-LISEL,
  3.       ECHOTEXT LIKE SY-LISEL.
  4. DATA: RFCDEST like rfcdes-rfcdest VALUE 'NONE'.
  5. DATA: RFC_MESS(128).
  6. REQUTEXT = 'HELLO WORLD'.
  7. RFCDEST = 'JCOSERVER01'. "corresponds to the destination name defined in the SM59
  8. CALL FUNCTION 'STFC_CONNECTION'
  9.    DESTINATION RFCDEST
  10.    EXPORTING
  11.      REQUTEXT = REQUTEXT
  12.    IMPORTING
  13.      RESPTEXT = RESPTEXT
  14.      ECHOTEXT = ECHOTEXT
  15.    EXCEPTIONS
  16.      SYSTEM_FAILURE        = 1 MESSAGE RFC_MESS
  17.      COMMUNICATION_FAILURE = 2 MESSAGE RFC_MESS.
  18. IF SY-SUBRC NE 0.
  19.     WRITE: / 'Call STFC_CONNECTION         SY-SUBRC = ', SY-SUBRC.
  20.     WRITE: / RFC_MESS.
  21. ENDIF.
End of the code.