Programming Example of Working Without Local sideinfo File

RFC_OPTIONS                       rfc_opt;
                                       /* Parameter for RFC connection    */
RFC_CONNOPT_VERSION_3             rfc_connopt_version_3;
                                       /* Spec. parameter for SAP system  */

RfcEnvironment(...);                   /* Install error handling function */

if (use_load_balancing)
{
       rfc_connopt_version_3.use_load_balancing = 1;
       rfc_connopt_version-3.lb_host = “hs0311”;
                                       /* host name of message server     */
       rfc_connopt_version_3.lb_system_name = “BIN”;
                                       /* Name of the SAP System          */
       rfc_connopt_version_3.lb_group = “PUBLIC”;
                                       /* Application server group        */
}
else
{
       rfc_connopt_version_3.use_load_balancing = 0;
                                       /* Connect to spec. appl. server   */
       rfc_connopt_version_3.hostname = “hs0011”;
                                       /* Host name of an appl. server    */
       rfc_connopt_version_3.sysnr = “53”;
                                       /* System number of the SAP System */
}

if (use_sapgui)
       rfc_connopt_version_3.use_sapgui = 1;
                                       /* Work with SAPGUI                */
else

       rfc_connopt_version_3.use_sapgui = 0;             /* or not        */

rfc_opt.mode = RFC_MODE_VERSION_3;                       /* RFC to SAP    */

rfc_opt.destination = “BIN”;           /* Destination in local sideinfo   */
rfc_opt.connopt = rfc_connopt_version_3;
                                       /* Includes connect parameters     */
rfc_opt.client = “000”;                /* Client in SAP system            */
rfc_opt.user = “RFCTEST”;              /* CPIC or dialog user             */
rfc_opt.password = “SECRET”;           /* Password                        */
rfc_opt.language = “E”;                /* Language                        */

if (ABAP_debug)
       rfc_opt.trace = ‘D’;            /* Working with ABAP-debugger      */
else
       rfc_opt.trace = 0;              /* or not                          */

if (rfc_trace)
rfc_opt.trace = rfc_opt.trace + 1;     /* 0/1:
Rfc-trace ON/OFF           */
                                       /* ‘D’: ABAP-debug                 */
                                       /* ‘E’: ABAP-debug plus RFC trace  */

rfc_handle = RfcOpen(&rfc_opt);

...

You can also issue RfcConnArgv or RfcConnArgv3 before RfcOpen to pass on the information about the SAP gateway to the RFC library. The RfcOpenExt and RfcOpenExtV3 are for non-C programs, such as Visual Basic programs.

For more details, see the sapinfo.c and srfctest.c in the RFC SDK.