Skip to Content
Former Member
Feb 04, 2005 at 12:47 AM

sap login programmatically


I didn't use SAP Login form.

Instead of SAP Login form, I made codes to connect to SAP like below sources.

When I run it, it connects to SAP and get some data from SAP successfully.

But, the page makes an error and didn't show the binded data at datagrid.

Can you help me?

The error message is belows.

PS : When I didn't connect with SAP, and bind the datagrid to internal table, it works fine.


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


// Declare parameters here

SAPProxy1 proxy = new SAPProxy1();

this.components = new System.ComponentModel.Container();

System.Configuration.AppSettingsReader configurationAppSettings = new System.Configuration.AppSettingsReader();

this.destination1 = new SAP.Connector.Destination(this.components);


// destination1


this.destination1.AppServerHost = ((string)(configurationAppSettings.GetValue("destination1.AppServerHost", typeof(string))));

this.destination1.SystemNumber = ((short)0);

this.destination1.Username = "RFCB2B";

this.destination1.Password = "SVCUSA";

this.destination1.Client = ((short)(160));

this.destination1.Language = "en";



SAP.Connector.SAPLoginProvider.OpenSAPConnection(this, destination1.ConnectionString, false);

proxy.Connection = SAP.Connector.SAPLoginProvider.GetSAPConnection(this);

// Call methods here

string strEsvc_Rfc_Ok = null;

ZWEBIF2 zBuffer = new ZWEBIF2();

zBuffer.Buffer = this.TextBox1.Text;

Input_Data = new ZWEBIF2Table();


proxy.Z_Web_Rfc_D3("WB_MODEL_SEARCH", "C310", "0001656428", "E", out strEsvc_Rfc_Ok, ref In_31, ref In_33,

ref In_39, ref In_81, ref In_82, ref In_83, ref Input_1000, ref Input_Data, ref Output_1000, ref zwebiF2Table1);



// Now update Data Bindings. On WinForms this will be automatic, on WebForms call the following line



catch(Exception ex)




// If SAPLoginProvider.GetSAPConnection(this) cannot get a connection, we might get an error. // Normally this can be ignored as it will automatically will force a relogon.




Server Error in '/WebApplication3' Application.


The resource cannot be found.

Description: HTTP 404. The resource you are looking for (or one of its dependencies) could have been removed, had its name changed, or is temporarily unavailable. Please review the following URL and make sure that it is spelled correctly.

Requested Url: /WebApplication3/default.aspx


Version Information: Microsoft .NET Framework Version:1.1.4322.2032; ASP.NET Version:1.1.4322.2032