Show TOC

Background documentationRFC_OPTIONS Locate this document in the navigation structure

 

The structure

Syntax Syntax

  1. typedef struct {
  2. 	char * destination;
  3. 	RFC_MODE mode;
  4. 	void * connopt;
  5. 	char * client;
  6. 	char * user;
  7. 	char * password;
  8. 	char * language;
  9. 	int trace;
  10. } RFC_OPTIONS;
End of the code.

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.

  • The data needed to establish the physical connection depend on the type of connection. Depending on the contents of the field 'mode', the field 'connopt' must point to different structures.

  • The signon data (client, user, password, language) are needed for authentication. Since RfcOpen only opens the physical connection directly, these data are only checked if the first RFC call is sent.

  • The third field contains a trace flag. If not zero, a trace file is written for all the operations corresponding to this connection to ease error analysis.

    Note Note

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

    End of the note.

This structure is defined in SAPRFC.H.

Members:
  • destination

    name of destination

    If the connection is not described completely, this name is used as a key for a 'sideinfo' where the connection should then be described. You always have to fill in this field.

  • mode

    connection mode

    There are two different protocol types for RFC, depending on whether your target system is an R/2 or SAP system.

    You can use various special options if you enter the value RFC_MODE_VERSION_3 here.

    Depending on the contents of this field, connopt must point to different structures (see RFC_MODE).

  • connopt

    If connopt is NULL, the 'sideinfo' or the 'saprfc.ini' file is used to determine the connection parameters.

    Without 'sideinfo.ini' file connopt must point to a structure of type RFC_CONNOPT_R3ONLY, RFC_CONNOPT_VERSION_3 or RFC_CONNOPT_CPIC depending in the value of 'mode'.

  • client

    signon data: client

  • user

    signon data: user

  • password

    signon data: password

  • language

    signon data: language

  • trace

    trace

    If 0, no trace is written. If not 0, the RFC library traces all activities into a file 'dev_rfc' in the actual working directory.

    If your target system is of Release 3.0C or later, you can enter the value 'D' here to start the ABAP debugger on the target system.

    The ABAP debugger can also be activated by setting the environment varialbe RFC_DEBUG before the call to RfcOpen is done.

    Syntax Syntax

    Options for an connection to an SAP system.

    1. // static = initialized structures
    2. static RFC_OPTIONS	options;
    3. static RFC_CONNOPT_R3ONLY	rfc_connopt_r3only;
    4. RFC_HANDLE	handle
    5. options.destination	= “TEST”;
    6. options.mode	= RFC_MODE_R3ONLY;
    7. options.client	= “000”;
    8. options.user	= “SAP*”;
    9. options.language	= “E”;
    10. options.password	= “PASS”;
    11. options.trace	= 0;	// turn trace off
    12. options.connopt	= 
    13. rfc_connopt_r3only.hostname	= “some_host”;	// some host name
    14. rfc_connopt_r3only.sysnr	= 0;	// system 00
    15. handle = RfcOpen();
    16. if(handle == RFC_HANDLE_NULL)
    17. {
    18. ...
    End of the code.