Skip to Content
author's profile photo Former Member
Former Member

RFCSDK programming to check RFC destinations if working

Hi all,

I'm trying to develop a C program using RFCSDK in order to monitor whether RFC R/3 connections (as listed in SM59) are working or not. I've been reading the sample codes under .../rfcsdk/text such as sapinfo.c and srfctest.c but I've not made any good progress about it.

How can I modify the existing code in order to suit my needs?



Add a comment
10|10000 characters needed characters exceeded

Related questions

2 Answers

  • author's profile photo Former Member
    Former Member
    Posted on Apr 16, 2004 at 01:43 PM


    Best way to start for testing connection is to find the default connection values defined in RFC_OPT structure in sapinfo.c (in my file it is on line 38) and replace the current values with those suitable for your SAP system. See code below:


    /* -

    • Defaults

    • ---------------------------------------------*/

    rfc_opt.client = "000";

    rfc_opt.user = "SAP*";

    rfc_opt.language = "E";

    rfc_opt.password = "PASS";

    rfc_opt.trace = 0;

    rfc_opt.mode = RFC_MODE_R3ONLY;


    Alternatively, simply compile the existing file, then execute "./sapinfo" with no arguments. You will be given a command usage message; follow the instructions to specify the logon parameters on the command line.



    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Apr 16, 2004 at 02:08 PM

    This doesn't make sense to me. The RFC destinations defined in SM59 are there to allow ABAP programs to reach out to external programs. The destinations have no meaning to an RFC client outside of SAP.

    You need to write an ABAP program that looks up and pings the relevant RFC destinations, best done by something like:


    I wouldn't be surprised if such a program already exists. Check programs beginning with RSRFC*.


    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      I'm sorry Dorian, but it seems to me that your response is not following the line of the original question posted.

      I am aware of the RFC protocol and the availability of the C libraries, in fact I have been coding RFC programs since 1994 when the SDK was initially released (with R/3 2.1C if I recall correctly).

      Whilst you are undoubtedly correct in your analysis of the functionality of the sapinfo.c example: in that it can allow test connections to RFC servers, most typically SAP systems. However, client RFC programs such as sapinfo.c have nothing to do with RFC destinations defined in transaction SM59.

      I'm probably telling you how to suck eggs, however when a client program seeks to connect to an RFC server program, it can obtain the connection information in a number of ways. The current version of the RFC SDK includes a function RfcOpenEx which receives connection information as a series of command-line like switches, for example:


      The point here is that this information is essentially the equivalent of the connection information stored in SM59 RFC destinations - however at no point do C-based (or Java or whatever) RFC clients use RFC destinations defined in SM59 to obtain connnection information.

      In fact it is a contradiction to think that a C-based RFC client could, because to access the RFC destination defined in SM59 they would first need to know the connection information to connect to the concerned SAP system!

      Rather, the RFC destinations defined in SM59 provide ABAP programs (acting as RFC clients) with the connection information necessary to call external RFC servers (be they functions in other SAP systems or non-SAP programs such as C program utilising the RFC SDK).

      The benefit of SM59 RFC destinations is that they provide a level of abstraction that allows an ABAP program to call into an external RFC server without needing to know where or how the RFC server is implemented. It makes no difference to the ABAP program whether the RFC server is running on the user's PC, another SAP system or perhaps a Java program.

      So getting back to the original question posted; I interpreted the question to ask how one could verify that the RFC destinations defined in SM59 were working - that is, that the target RFC server was accessible. The only way to do this is through ABAP logic that invokes the RFC destination. Of course this can only be done properly by knowing a function of the target RFC server that can be called. Fortunately every RFC server program automatically implements a number of functions, such as RFC_PING. Therefore the following logic might be used:







      IF SY-SUBRC NE 0.




      So, in summary, I would adapt your sentence to read:

      SAP RFC destinations (defined in SM59) are used for program-to-program communication between ABAP client programs and any system that implements the server portion of the RFC protocol.

      Kind regards,


Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.