Skip to Content
Author's profile photo Former Member

RFC Destination Check

ABAP Connection or RFC Destination needs to be checked before calling any remote enabled function module, if connection is  checked prior to a Remote function module call, we can avoid system dumps whenever RFC destination is down or incase of login problems.

Manual way to test a RFC connection is to goto transaction SM59, select the RFC Destination, Double click on the same and Click on Action Button – Connection Test

/wp-content/uploads/2014/12/conncetion_test_605221.png

AUTOMATED PROGRAM TO SIMULATE SM59 – Connection Test

I have create a program using a standard function module CAT_CHECK_RFC_DESTINATION , Syntax of the program as follows :

REPORT zcvtest.

PARAMETERS: P_lsys like RSCATRFCDEST.

data: l_msgv1 type symsgv1,
      l_msgv2 type symsgv2,
      l_subrc type sysubrc.

CALL FUNCTION ‘CAT_CHECK_RFC_DESTINATION’
  EXPORTING
    rfcdestination       = p_lsys
IMPORTING
   MSGV1                = l_msgv1
   MSGV2                = l_msgv2
   RFC_SUBRC            = l_subrc.

if l_subrc = ‘0’.
  write: ‘Success’.
else.
  write: l_msgv1,l_msgv2.
endif.

Test Results

Negative Case – A Failed RFC

/wp-content/uploads/2014/12/sm59_1_619213.png

Using the program, Same RFC destination is checked:

Selection Screen

SS1.png

Output

OP1.png

Success Case

/wp-content/uploads/2014/12/sm59_2_605286.png

Selection screen

SS2.png

Output

Op2.png

Value : This document shows efficient way of using Function module to check RFC connection before making any RFC Calls, this will make sure that no dumps are encountered in the production system.

Assigned Tags

      6 Comments
      You must be Logged on to comment or reply to a post.
      Author's profile photo Former Member
      Former Member

      This document shows efficient way of using Function module to check RFC connection before making any RFC Calls, this will make sure that no dumps are encountered in the production system.

      You'll not get any short dumps, if you handle the RFC exceptions correctly. May be you should read this - ABAP Keyword Documentation.

      Author's profile photo Former Member
      Former Member

      This document is really helpful to check RFC connections and avoid dumps.

      Author's profile photo Former Member
      Former Member

      Thanks for sharing this piece of info.It's very helpful.

      Author's profile photo Former Member
      Former Member

      perfect !! the one i used gave dump when the system was down as it only checked the connection. this one is just perfect !!

      Author's profile photo Ramesh Palle
      Ramesh Palle

      Very useful document. Thanks Chirayu.

      Author's profile photo Walter Habich
      Walter Habich

      You can use existing function UGMD_SCDT_CHECK_RFCDEST. It worked without dialog or popup.  A rfc destination with locked user in remote system returned failure.

      FUNCTION ugmd_scdt_check_rfcdest.
      *"----------------------------------------------------------------------
      *"*"Lokale Schnittstelle:
      *"  IMPORTING
      *"     REFERENCE(I_RFCDEST) TYPE  RFCDEST
      *"  EXCEPTIONS
      *"      FAILURE
      *"----------------------------------------------------------------------
      DATA:  rfcmess(80TYPE c.

      CALL FUNCTION 'RFC_PING' DESTINATION i_rfcdest
      EXCEPTIONS
      system_failure        1  MESSAGE rfcmess
      communication_failure 2  MESSAGE rfcmess.

      IF sy-subrc NE 0.
      MESSAGE e017(ugmd9WITH i_rfcdest rfcmess RAISING failure.
      *         RFC-Fehler bei Destination &1 -> siehe Langtext
      ENDIF.

      CALL FUNCTION 'RFCPING' DESTINATION i_rfcdest
      EXCEPTIONS
      system_failure        1  MESSAGE rfcmess
      communication_failure 2  MESSAGE rfcmess.

      IF sy-subrc NE 0.
      MESSAGE e017(ugmd9WITH i_rfcdest rfcmess RAISING failure.
      *         RFC-Fehler bei Destination &1 -> siehe Langtext
      ENDIF.

      ENDFUNCTION.