Better use the call RfcOpenEx.

The following function opens an RFC connection. All parameters are passed as single fields:

RFC_HANDLE SAP_API RfcOpenExt(char* destination,
RFC_MODE mode,
char* hostname,
int sysnr,
char* gateway_host,
char* gateway_service,
char* client,
char* user,
char* password,
char* language,
int trace);

RFC opens the connection using the given options, and returns a handle for the connection established.

The input parameters to this function carry the same information as that sent to RfcOpen, but not packed in structures. Instead, individual fields are sent. At any given time, some of these fields are empty, depending on the value of mode:

The fields hostname, sysnr, gateway_host, and gateway_service have valid information in them.

Only the fields gateway_host, and gateway_service have valid information in them.

This function is defined in SAPRFC.H.

Return Values:

Function Parameters:

See also RfcOpen, RfcOpenExtV3 and RFC_OPTIONS for further description of these fields. In general, the input parameters allow the system to avoid accessing the sideinfo table. If you send the relevant parameters as null fields ( hostname for R/3, the gateway fields for R/2), the sideinfo table will be accessed to get the needed information.

If you call RfcOpenExt with an invalid password, the function does not immediately fail. However, the subsequent call to RfcCallExt (or RfcCallReceiveExt) will fail.