on 04-22-2012 7:28 PM
I have a Windows Form App that makes an RFC call to SAP using NCO3. However I noticed in SAP when I look at the gateway monitor, the connection stays alive until the app itself closes in Windows.
How do I "logoff" the connection in my Windows App without having to close the app itself?
Here's the code I have so far..
RfcConfigParameters myConfig = new RfcConfigParameters();
myConfig.Clear();
myConfig.Add("USER", txtUserName.Text);
myConfig.Add("PASSWD", txtPassword.Text);
myConfig.Add("CLIENT", txtClient.Text);
myConfig.Add("LANG", "EN");
myConfig.Add("SYSNR", txtSystemNumber.Text);
myConfig.Add("ASHOST", txtAppServerHost.Text);
myConfig.Add("NAME", txtSystemName.Text);
//Get destination instance
RfcDestination destination = RfcDestinationManager.GetDestination(myConfig);
IRfcFunction function = null;
try
{
function = destination.Repository.CreateFunction("STFC_CONNECTION");
function.SetValue("REQUTEXT", "Hello SAP");
function.Invoke(destination);
}
catch (RfcBaseException e3)
{
MessageBox.Show(e3.Message);
return;
}
string msg4box = "SUCCESS";
MessageBox.Show(msg4box);
Hi,
You can use RfcDestinationManager.UnregisterDestinationConfiguration(ID);
where ID is your implementation of IDestinationConfiguration.
just remember to re-register this ID if you wish to continue activity with SAP ( otherwise you can get exception ).
Yarden
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
84 | |
10 | |
10 | |
10 | |
7 | |
6 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.