Quantcast
Channel: SCN : All Content - ABAP Connectivity
Viewing all articles
Browse latest Browse all 1442

RFC Destination Check

$
0
0

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

 

 

 

conncetion_test.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 RSCAT-RFCDEST.

data: l_msgv1 type sy-msgv1,
      l_msgv2 type sy-msgv2,
      l_subrc type sy-subrc.

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

 

 

 

sm59_1.png

Using the program, Same RFC destination is checked:

 

Selection Screen

 

SS1.png

 

Output

 

OP1.png

 

 

Success Case

 

sm59_2.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.


Viewing all articles
Browse latest Browse all 1442

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>