Show TOC

Background documentationProgramming Example of Working Without Local sideinfo File Locate this document in the navigation structure

 

Syntax Syntax

  1. RFC_OPTIONS	rfc_opt;
  2. 		/*	Parameter for RFC connection	*/
  3. RFC_CONNOPT_VERSION_3	rfc_connopt_version_3;
  4. 		/*	Spec. parameter for SAP system	*/
  5. RfcEnvironment(...);	/*	Install error handling function	*/
  6. if (use_load_balancing)
  7. {
  8. 	rfc_connopt_version_3.use_load_balancing = 1;
  9. 	rfc_connopt_version-3.lb_host = “hs0311”;
  10. 		/*	host name of message server	*/
  11. 	rfc_connopt_version_3.lb_system_name = “BIN”;
  12. 		/*	Name of the SAP System	*/
  13. 	rfc_connopt_version_3.lb_group = “PUBLIC”;
  14. 		/*	Application server group	*/
  15. }
  16. else
  17. {
  18. 	rfc_connopt_version_3.use_load_balancing = 0;
  19. 		/*	Connect to spec. appl. server	*/
  20. 	rfc_connopt_version_3.hostname = “hs0011”;
  21. 		/*	Host name of an appl. server	*/
  22. 	rfc_connopt_version_3.sysnr = “53”;
  23. 		/*	System number of the SAP System	*/
  24. }
  25. if (use_sapgui)
  26. 	rfc_connopt_version_3.use_sapgui = 1;
  27. 		/*	Work with SAPGUI	*/
  28. else
  29. 	rfc_connopt_version_3.use_sapgui = 0;	/*	or not	*/
  30. rfc_opt.mode = RFC_MODE_VERSION_3;	/*	RFC to SAP	*/
  31. rfc_opt.destination = “BIN”;	/*	Destination in local sideinfo	*/
  32. rfc_opt.connopt = rfc_connopt_version_3;
  33. 		/*	Includes connect parameters	*/
  34. rfc_opt.client = “000”;	/*	Client in SAP system	*/
  35. rfc_opt.user = “RFCTEST”;	/*	CPIC or dialog user	*/
  36. rfc_opt.password = “SECRET”;	/*	Password	*/
  37. rfc_opt.language = “E”;	/*	Language	*/
  38. if (ABAP_debug)
  39. 	rfc_opt.trace = ‘D’;	/*	Working with ABAP-debugger	*/
  40. else
  41. 	rfc_opt.trace = 0;	/*	or not	*/
  42. if (rfc_trace)
  43. rfc_opt.trace = rfc_opt.trace + 1;	/*	0/1: Rfc-trace ON/OFF	*/
  44. 		/*	‘D’: ABAP-debug	*/
  45. 		/*	‘E’: ABAP-debug plus RFC trace	*/
  46. rfc_handle = RfcOpen();
  47. ...
End of the code.

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.