How to validate RFC connection in SAP?

Author | Last Updated| | 6 Comments | F Share

Validating RFC destination before calling RFC function module, check RFC connection using Function module RFC_PING

+ -

In ABAP programming, some times we may need to validate and check RFC Destination before calling a function module, you can find useful information in this tutorial.

Required validations for RFC:

  • Check if RFC destination is available or not.
  • Check RFC destination connection is working or not.

Example programm to validate RFC destination

All the RFC destinations are stored in table RFCDES, we can check connection using function module RFC_PING (When ever you call and RFC, it will automatically validate connection, if you need to validate explicitly you can use this function module).

REPORT ZSAPN_CHECK_RFC.
DATA : WA_RFCDES TYPE RFCDES.
PARAMETERS P_RFC TYPE STRING.

START-OF-SELECTION.
  SELECT SINGLE * FROM RFCDES INTO WA_RFCDES WHERE RFCDEST = P_RFC.
  IF WA_RFCDES IS NOT INITIAL.
    CALL FUNCTION 'RFC_PING' DESTINATION P_RFC.

    IF SY-SUBRC EQ 0.
      MESSAGE 'RFC connection is perfect' TYPE 'S'.

    ELSE.
      MESSAGE 'RFC is not working' TYPE 'E'.
    ENDIF.

  ELSE.
    MESSAGE 'RFC destination dosent exist' TYPE 'E'.
  ENDIF.

Tutorial Comments

Total Comments: Add your Comment
07 Sep 2014

Nice one Ashok. Keep it up. :)

07 Aug 2015

VNDAS[OVP]SDVSMVV VVVVKSV VISAV

01 Aug 2016

Useful information bro..keep it up.

01 Aug 2016

Useful information bro..keep it up.

01 Aug 2016

Useful information bro..keep it up.

14 Jun 2017

Hi Ashok, Thanks for the information. Can it possible for multiple or mass RFC Connection test at a time. If no, Can you please help me for ABAP code for this. (Multiple/mass RFC Connection test at a time)

Leave a Comment

Enter Comment Text