Skip to Content
Former Member
Mar 01, 2006 at 10:26 AM

Index out of bound array : calling bapi



I am facing a problem while executing a BAPI using the SAP .net connector. The steps I performed are as follows:

Created a web project in Visual Studio .net using

Added the SAP Connector Proxy to the project

Dragged a Bapi_Customer_Getcontactlist onto the proxy

Created a page with a button on it

In the button_Click event of the web form I wrote the following code

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

Dim Maxrows As Integer = 10

Dim Return0 As BAPIRETURN1

Dim Contactaddressdata As BAPICONTACT_ADDRESSDATATable

Dim Customerrange As BAPICUSTOMER_IDRANGETable

SapProxy11.Bapi_Customer_Getcontactlist(Maxrows, Return0, Contactaddressdata, Customerrange)

End Sub

But when I execute the code the method the control goes into the SAPProxy1.vb file in which the code for the method Bapi_Customer_Getcontactlist contains a statement as follows

Dim results As Object()

results = SAPInvoke("Bapi_Customer_Getcontactlist", New Object() { _

Maxrows, Contactaddressdata, Customerrange})

When the SAPInvoke method is executed it gives an exception saying “Index was outside the bounds of the array.”

For any other bapi that I execute it gives the same error. Please someone help me to execute the BAPI and let me know if I have missed out something.