private static void StartRFCServer() { try { RFCServer s = new RFCServer(); s.GatewayHost = "52.200.13.213"; s.GatewayHost = "vhcals4hci.dummy.nodomain"; //s.GatewayHost = "ec5.theobald-software.com"; s.GatewayService = "sapgw00"; s.ProgramID = "ERPTEST"; s.IncomingCall += new ERPConnect.RFCServer.OnIncomingCall(s_IncomingCall); RFCServerFunction f = s.RegisteredFunctions.Add("Z_ADD"); f.Imports.Add("NUMBER1", RFCTYPE.INT); f.Imports.Add("NUMBER2", RFCTYPE.INT); f.Exports.Add("RES", RFCTYPE.INT); s.Start(); Console.WriteLine("Server is running. Press any key to exit."); Console.ReadLine(); s.Stop(); } catch (Exception e1) { Console.WriteLine(e1.Message.ToString()); Console.ReadLine(); } }
private static void s_IncomingCall(RFCServer Sender, RFCServerFunction CalledFunction) { if (CalledFunction.FunctionName == "Z_ADD") { Int32 i1 = (Int32)CalledFunction.Imports["NUMBER1"].ParamValue; Int32 i2 = (Int32)CalledFunction.Imports["NUMBER2"].ParamValue; Int32 erg = i1 + i2; CalledFunction.Exports["RES"].ParamValue = erg; Console.WriteLine("Incoming Call"); Console.WriteLine(i1 + " + " + i2 + " = " + erg); } else { throw new ERPConnect.ERPException("Function unknown"); } }