cancel
Showing results for 
Search instead for 
Did you mean: 

.Net application - Problem executing the Bapi

Former Member
0 Kudos

Hi,

Im trying to develop iviews using sap portal netweaver pdk2.0 and .NET2003 .Im able to add destination in a portal from the server explorer,for connecting to R3 server im creating a portal destination and setting the alias sucessfully also,and it gets complied without error,but when i try to run the iview it gives me the following error:

Server Error in '/EPApp2000' Application.

-


You must set a connection before doing a call.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: SAP.Connector.RfcException: You must set a connection before doing a call.

-


Following is the peice of that I have written to execute the Bapi.

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

{

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

//sapProxy11.Connection = SAP.Connector.SAPLoginProvider.OpenSAPConnection(

this.sapProxy11.Bapi_Bank_Getlist("DE",10,out salesList,ref bapI1011_LISTTable1);

Table1.DataSource = bapI1011_LISTTable1;

Table1.DataBind();

Response.Write("Hello World");

}

The GetSAPConnection() method is expecting a System.web.ui.page object as parameter. But since we are writing a component, the 'this' has the Component object.

Regards,

Babu

Accepted Solutions (0)

Answers (1)

Answers (1)

rima-sirich
Advisor
Advisor
0 Kudos

Hi Babu,

As .NET PortalComponent is a UserControl and not ASP .NET Page, I think you should call to GetSAPConnection() method with parameter this.Page .

Regards,

Rima.

Former Member
0 Kudos

Hi Rima,

Finally it was sorted out ,we have to add 2 parameters in the GetSAPConnection method.

-


SAP.Connector.SAPLoginProvider.GetSAPConnection(this.Page,this.portalDestinationName);

-


Regards

Babu