cancel
Showing results for 
Search instead for 
Did you mean: 

Loging in SAP using SAPLogonCtrl

Former Member
0 Kudos

Hi

I'm trying to connect to a SAP server using the SAPLogon Control. I'm entirely new to SAP and .NET can anybody help me in this regard. If you have a sample code, it would be of tremendous help.

My applicatio should have embedded .NET scripts to update the SAP servers

Can anybody help me???

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi,

Use this...

private Connection GetRFCConnection(string username, string password

   , string language, string strSystem, string strSystemID, string client)

  {

   SAPLogonCtrl.SAPLogonControlClass log_c = new SAPLogonCtrl.SAPLogonControlClass();

   log_c.Language = language;

   log_c.Password = password;

   log_c.User = username;

   log_c.System = strSystemID;     

   log_c.Client = client;  

   object obj_conn = log_c.NewConnection();

   SAPLogonCtrl.Connection conn = obj_conn as SAPLogonCtrl.Connection;

   conn.Logon (null,true);

   return conn;

  }