3

I'm developing an ABAP PROGRAM which calls RFC from differrent SAP systems. Is there any way to check if the RFC exists in the destination system before calling the RFC?

Sandra Rossi
  • 11,934
  • 5
  • 22
  • 48
Skalozub
  • 539
  • 7
  • 26
  • 1
    "check if the RFC exists" : RFC is the name of the SAP protocol (Remote Function Call), so you'd better say "remote-enabled function module" or "RFC-capable function module". – Sandra Rossi Sep 14 '18 at 12:04

2 Answers2

6

You can use FM FUNCTION_EXISTS to check, if an FM exists or not. Obviously you have to call it remotly. Roughly:

CALL FUNCTION 'FUNCTION_EXISTS'
  DESTINATION ... 
  EXPORTING
    funcname                 = 'xxx' => enter the FM here, which has to be checked
* IMPORTING
*   GROUP                    =
*   INCLUDE                  =
*   NAMESPACE                =
*   STR_AREA                 =
 EXCEPTIONS
   FUNCTION_NOT_EXIST       = 1
   OTHERS                   = 2.

If the FM exists, the importing parameters will have valid values, otherwise FUNCTION_NOT_EXIT exception will be raised.

József Szikszai
  • 4,791
  • 3
  • 14
  • 24
0

Most common way in my opinion is to use RFC_PING:

 CALL FUNCTION 'RFC_PING' DESTINATION <your destination here>.
Anton Semenov
  • 6,227
  • 5
  • 41
  • 69