cancel
Showing results for 
Search instead for 
Did you mean: 

Calling BAPI with out parameters

Former Member
0 Kudos

Hi all,

I am using the SAP .net Connector in vb.net and I am able to execute the RFC using the following code.

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

        Dim RfcProxy1 As RFCProxy = New RFCProxy

        Try
            RfcProxy1.Connection = SAP.Connector.SAPLoginProvider.GetSAPConnection(Me.Page)
            RfcProxy1.Rfc_Customer_Get("", TextBox1.Text, BrfcknA1Table1)
            DataBind()
        Catch ex As Exception
            MsgBox(ex.Message)
        End Try

    End Sub

This code works fine and the result of the call is returned back in the SAP table BrfcknA1Table1 because all the parameters of this most commonly suggested RFC are either <b>in</b> or <b>inout</b>.

But now if I want to execute similar code for a method which has atleast one <b>Out</b> (Note: Not InOut) parameter then the SAPInvoke method of the proxy method in SAPProxy1.vb file generates an exception with the message "Index was out of bound of Array". This is because the SAPInvoke method passes only the input parameters while making the call. If I manually modify the SAPInvoke method by specifying all the parameters, neither exception is generated nor output is returned.

I would appreciate if anybody could help me with an example or step by step procedure to call methods having atleast one <b>Out</b> parameter (Note: I dont mean InOut).

Thanks & Regards,

Anugraha

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

I got it.....I just had to initialize the output parameters by creating their instances. i.e. Every output parameter variable that I pass I had to initialize it using the New keyword. Once initialized the method can be executed without modifying any code in the Proxy.

Thanks to all who have tried it out for me.