Hi All,
I'm trying to connect my ASP.net Project with SAP but I keep hitting error at
sapBapi.Connection = sapConnection;
The Error Message is The server threw an exception. (Exception from HRESULT: 0x80010105 (RPC_E_SERVERFAULT))
Below is my code
private DataTable myDt;
private SvrConn.DBConnection MyConn = new SvrConn.DBConnection();
private SAPBAPIControlLib.SAPBAPIControl MySAP = new SAPBAPIControlLib.SAPBAPIControl();
SAPLogonControlClass sapLogon;
SAPBAPIControlClass sapBapi;
SAPLogonCtrl.Connection sapConnection;
SQLFunctionCall SQLFunc = new SQLFunctionCall();
private bool ConnectSAP()
{
SvrConn.SAPConnection SAPSvrCon = new SvrConn.SAPConnection();
sapLogon = new SAPLogonControlClass();
sapBapi = new SAPBAPIControlClass();
string ApplicationServer = SAPSvrCon.ApplicationServer(false);
string System = SAPSvrCon.System(false);
string SystemNumber = SAPSvrCon.SystemNumber(false);
string Client = SAPSvrCon.Client(false);
string User = SAPSvrCon.User(false);
string Password = SAPSvrCon.Password(false);
string Language = SAPSvrCon.Language(false);
sapLogon.ApplicationServer = ApplicationServer;
sapLogon.Client = Client;
sapLogon.System = System;
sapLogon.Language = Language;
sapLogon.User = User;
sapLogon.Password = Password;
sapLogon.SystemNumber = 00;
sapConnection = (SAPLogonCtrl.Connection)sapLogon.NewConnection();
return sapConnection.Logon(0, true);
}
//object sender, ServerValidateEventArgs args
private void ISValidSubcode()
{
if (ConnectSAP())
{
sapBapi = new SAPBAPIControlClass();
sapBapi.Connection = sapConnection;
Object oBAPICtrl = sapBapi.GetSAPObject("BAPI_PROJECT_GETINFO","","","","","","","","","","");
string Result = oBAPICtrl.ToString();
}
else
{
ScriptManager.RegisterStartupScript(this, this.GetType(), "msg", "alert('Error in Connection');", true);
return;
}
}
Can anyone help me to find out my problem.
I'm very urgent of this issue.
Thanks a billion....