Recently though I came across another one that has proven to be invaluable to me. We have lots of different systems here and in my BSP Development I tend to find some reason to connect to all of them for data using RFC Destinations.
Well the other day I had major problems, it turns out that one my RFC destinations was basically dead but I had never bothered to do that much needed error checking in the programming, yes a slap in the face to me and not considered good programming.
So I began playing around with TRY ENDTRY and CATCH and ENDCATCH commands and all of that stuff then I thought, there must be a way to do this easier. So I started searching around in our 6.40 SP12 system and I came across a function module.
That is what I found and I just love it. Very easy to implement and to use, just make a quick call and check the SY-SUBRC value.
> CALL FUNCTION ‘RFC_VERIFY_DESTINATION’
destination = tmp
TIMEOUT = 10
INTERNAL_FAILURE = 1
TIMEOUT = 2
DEST_COMMUNICATION_FAILURE = 3
DEST_SYSTEM_FAILURE = 4
UPDATE_FAILURE = 5
NO_UPDATE_AUTHORITY = 6
OTHERS = 7.
IF SY-SUBRC EQ ‘0’.
“* Do code here
Just have to give the RFC destination you want to verify, this is a parameter with the type STRING. Oh, another really nice feature is the TIMEOUT default is set to 60 (seconds) so you can really fine tune your connection settings to get the performance you want, I mean no sense in pulling a huge set of data over if your connection takes to long now is it?
There are several EXPORTING parameters you may find very useful as well. Although for me I just needed to ensure the system was there but I have recently started checking the available resources of the system before connecting to ensure a quick execution time.
> *” EXPORTING
*” VALUE(RFCSI_EXPORT) LIKE RFCSI STRUCTURE RFCSI
*” VALUE(RFC_LOGIN_COMPLETE) LIKE SY-DEBUG
*” VALUE(DIALOG_USER_TYPE) LIKE SY-DEBUG
*” VALUE(CURRENT_RESOURCES) LIKE SY-INDEX
*” VALUE(MAXIMAL_RESOURCES) LIKE SY-INDEX
*” VALUE(RECOMMENDED_DELAY) LIKE SY-INDEX
*” VALUE(CHARSIZE) TYPE RFCOPT-RFCUNICODE
*” VALUE(UPDATED) TYPE CHAR1
This little guy has proven to be a gem for me and so I thought I would share with everyone that doesn’t know about it. What’s really nice, I haven’t found any OSS notes telling me “NOT RELEASED FOR CUSTOMER USE”.