Show TOC

Procedure documentationInbound RFC Connection (from the SAP Server) Locate this document in the navigation structure

Procedure

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