Skip to Content
0
Former Member
Jun 27, 2005 at 03:12 PM

SAP .Net Connector working.....

723 Views

Dear All,

Can anyone pls explain me the working of SAP .Net Connector.

Let me tell you what exactly is the confusion.

And pls forgive me if i made a mistake as i am not used to SAP, but only DOT NET.

What actually i want to know is that -->

1) We have a SAP at one end.

2) We have .Net at other end.

3) SAP .Net Connector acts a middle layer between SAP and .Net.

But if i want to use the functionality of SAP, lets say a Function Module of SAP into .Net, how can I do that????

And what am trying in my code in C#.Net is as follows:

i have added refernece of SAP BAPI Control and SAP Login Control in my WebForm.

The code is:

private void Page_Load(object sender, System.EventArgs e)

{

SAPBAPIControlLib.SAPBAPIControlClass obj=new SAPBAPIControlClass();

}

SAPLogonCtrl.SAPLogonControlClass log=new SAPLogonControlClass();

SAPBAPIControlLib.SAPBAPIControlClass obj;

obj.Connection =log.NewConnection();

log.ApplicationServer ="132.186.124.31";

log.System="00";

log.User="9999sde";

log.Password ="snehad";

log.Client="800";

log.Language="EN";

//Check if the connection was succesfully established

if(log.Logon(0,false)=false)

{

StringBuilder str= new StringBuilder();

str.Append("<script language='javascript'>");

str.Append("alert('Connection Failed')");

str.Append("</script>");

RegisterStartupScript("Msg", str.ToString());

}

else

{

StringBuilder str= new StringBuilder();

str.Append("<script language='javascript'>");

str.Append("alert('Connection Sucessful')");

str.Append("</script>");

RegisterStartupScript("Msg", str.ToString());

}

}

But am getting error at the if condition.

Also, do i need a SAP Proxy Class to connect with SAP???

Cant i connect to SAP with the above code???

i will be grateful if anyone can help me out instead of suggesting any new link of SAP.

pls help me out.

Its urgent.

Thanks & Regards,

Muskaan.