Is there any way to check if RFC exists in a SAP system

Viewed 1539

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?

2 Answers

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.

Most common way in my opinion is to use RFC_PING:

 CALL FUNCTION 'RFC_PING' DESTINATION <your destination here>.
Related