VS2010 vb.net SAP.net connector Step by step guide to send parameter and get result from BAPI Function

In continuatiuon to my Last Post:

Imports SAP.Middleware.Connector

Public Class ECCDestinationConfig
    Implements IDestinationConfiguration

    Public Event ConfigurationChanged(ByVal destinationName As String, ByVal args As RfcConfigurationEventArgs) Implements IDestinationConfiguration.ConfigurationChanged

    Public Function GetParameters(ByVal destinationName As String) As RfcConfigParameters Implements IDestinationConfiguration.GetParameters

        Dim parms As New RfcConfigParameters

        Select Case destinationName

            Case "DEV"

                parms.Add(RfcConfigParameters.AppServerHost, "")
                parms.Add(RfcConfigParameters.SystemNumber, "00")
                parms.Add(RfcConfigParameters.SystemID, "ED1")
                parms.Add(RfcConfigParameters.User, "009383")
                parms.Add(RfcConfigParameters.Password, "vvvvv")
                parms.Add(RfcConfigParameters.Client, "100")
                parms.Add(RfcConfigParameters.Language, "EN")
                parms.Add(RfcConfigParameters.PoolSize, "5")
                parms.Add(RfcConfigParameters.PeakConnectionsLimit, "10")
                parms.Add(RfcConfigParameters.IdleTimeout, "600")

            Case Else

        End Select

        Return parms

    End Function

    Public Function ChangeEventsSupported() As Boolean Implements IDestinationConfiguration.ChangeEventsSupported
        Return False
    End Function

End Class

Imports SAP.Middleware.Connector
Public Class Form1
    Private _ecc As RfcDestination
    Public log As String = ""
    Private Sub Form1_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
            RfcDestinationManager.RegisterDestinationConfiguration(New ECCDestinationConfig)
            _ecc = RfcDestinationManager.GetDestination("DEV")
            Dim repository As RfcRepository = _ecc.Repository

            Dim bapiGetCompanyList As IRfcFunction = repository.CreateFunction("BAPI_COMPANY_GETLIST")
            Dim bapiGetCompanyDETAIL As IRfcFunction = repository.CreateFunction("BAPI_COMPANY_GETDETAIL")

            'populate from SAP
            Dim companytable As IRfcTable = bapiGetCompanyList.GetTable("Company_List")
            Dim rfcreturn As IRfcStructure = bapiGetCompanyList.GetStructure("RETURN")

            For companyptr As Integer = 0 To companytable.RowCount - 1
                companytable.CurrentIndex = companyptr
                Dim companynumber = companytable.GetString("COMPANY")
                log = log & companynumber & " " & companytable.GetString("NAME1")
                '' now get value from function by passing parameters
                bapiGetCompanyDETAIL.SetValue("COMPANYID", companynumber)
                'populate from SAP
                Dim rfcreturn1 As IRfcStructure = bapiGetCompanyDETAIL.GetStructure("RETURN")
                Dim companydetail As IRfcStructure = bapiGetCompanyDETAIL.GetStructure("COMPANY_DETAIL")
                log = log & companydetail.GetString("CITY") & companydetail.GetString("STREET") & companydetail.GetString("COUNTRY") & vbCrLf
            TextBox1.Text = log

           Catch ex As Exception
            TextBox1.Text = log & "Error " & ex.Message

        End Try
    End Sub
End Class


this is good and helpful post.
Could you please share some example that how we can use use Badi ACC_Document in BAPI_ACC_DOCUMENT_POST in table extn1 or extn2. its very urgent.
Thanks in Advance

Most Viewed Post

solution for facebook static.ak.fbcdn.net waiting

Connect Sony XPLOD MEX-BT2500 Bluetooth CD Receiver with ur mobile

Crystal Report : Show data horizontally (Left to right) i.e. columns as rows

Google+ Followers