RFC_OPTIONS

The structure

typedef struct {
char * destination;
RFC_MODE mode;
void * connopt;
char * client;
char * user;
char * password;
char * language;
int trace;
} RFC_OPTIONS;

provides parameters for RfcOpen.

Depending on the type of connection, various data have to be supplied to open an RFC connection.

There are three ways to supply this information:

  1. You can enter a destination name pointed to an entry in a ‘saprfc.ini’ file which contains the necessary network parameters and RFC-specific parameters for opening the connection at RfcOpen.
  2. You can enter a destination name pointed to an entry in a ‘sideinfo’ file which only contains the necessary network parameters for opening the connection at RfcOpen
  3. In your program you supply all the data needed for opening the connection at RfcOpen.

The first of these methods is recommended (i.e. working with saprfc.ini), because it allows you to use some RFC features today as well as in the future without changing your RFC programs. See sprfc.ini for more details.

Fields that are not supplied must be set to NULL.

The RFC_OPTIONS structure consists of three groups.

This structure must be completely initialized with 0. This will ensure that in the future SAP can add more connection parameters.

This structure is defined in SAPRFC.H.

Members:

Options for an R/3 connection.

// static = initialized structures
static RFC_OPTIONS options;
static RFC_CONNOPT_R3ONLY rfc_connopt_r3only;
RFC_HANDLE handle

options.destination = "TEST";
options.mode = RFC_MODE_R3ONLY;
options.client = "000";
options.user = "SAP*";
options.language = "E";
options.password = "PASS";
options.trace = 0; // turn trace off

options.connopt = &rfc_connopt_r3only;

rfc_connopt_r3only.hostname = "some_host"; // some host name
rfc_connopt_r3only.sysnr = 0; // system 00

handle = RfcOpen(&options);
if(handle == RFC_HANDLE_NULL)
{
...