RfcConnect

The function

RFC_HANDLE   SAP_API  RfcConnect(char *                  system_name,
                                    char *              ms_hostname,
                                    char *              group_name,
                                    char *              client,
                                    char *              user,
                                    char *              password,
                                    char *              language,
                                    int                 trace,
                                    RFC_HOSTNAME        as_hostname,
                                    int *               sysnr);

opens an RFC connection via LOAD BALANCING.

With this function the RFC library will try to connect to an application server with the least load (LOAD BALANCING principle) within a group of predefined application servers.

This function is only available for Release 3.0 onwards.

Better use the call RfcOpenEx.

This function has the following advantages:

·        The load in the SAP system is distributed to different application servers.

·        RFC connections are thus independent of a specific application server (with RfcOpen or RfcOpenExt an RFC connection could only be established to a predefined application server).

·        Only the host name of the message server and its port number of the according SAP system are required in the host file and the services file.

Information about the SAP gateway, application server, system number, etc. as parameters for RfcOpen or RfcOpenExt or as parameters in sideinfo are no longer necessary. Even the sideinfo is no longer required.

You ought to use RfcOpen or RfcOpenExtV3 with RFC_MODE, RFC_MODE_VERSION3 or RFC_MODE_PARAMETER instead of this function.

This function is defined in SAPRFC.H.

Return Value:

·        returns a handle to the RFC connection (RFC_HANDLE) or RFC_HANDLE_NULL if the connection cannot be opened.

Function Parameters:

·        system_name

name of the SAP system

·        ms_hostname

host name of the message server

·        group_name

name of a specific group of application servers

·        client

signon data: client

·        user

signon data: user-ID

·        password

signon data: password

·        language

signon data: language

·        trace

trace /0/1)

·        as_hostname

name of the connected application server (output parameter)

·        sysnr

system number of the connected SAP system (output parameter)

See also RfcOpen, RFC_OPTIONS, RfcOpenExtV3 and RFC_OPTIONS.