cancel
Showing results for 
Search instead for 
Did you mean: 

problem in passing datatable to BAPI_SALESORDER_CREATEFROMDAT2 in VB.net

Former Member
0 Kudos

Hello Gurus,

I am using Bapi_Salesorder_Createfromdat2 in VS 2008(VB.NET) but not able to pass the ordr_partners As BAPIPARNRTable in BAPI , i tried debugging but cannot see any value in ORDER_PARTNERS table in ECC.

Please check if anything missing in passing datatable to BAPI

Dim proxy As New ClassLibrary1.SAPProxy1

Dim hdr As BAPISDHD1 = New BAPISDHD1

Dim itm As BAPISDITM = New BAPISDITM

Dim itmtbl As BAPISDITMTable = New BAPISDITMTable

Dim return2 As BAPIRET2Table = New BAPIRET2Table

Dim Ordr_partnersx As BAPIPARNR = New BAPIPARNR

Dim ordr_partners As BAPIPARNRTable = New BAPIPARNRTable

Dim orderkeysx As BAPISDKEY = New BAPISDKEY

Dim orderkeys As BAPISDKEYTable = New BAPISDKEYTable

Dim order_schedules_inx As BAPISCHDL = New BAPISCHDL

Dim order_schedules_in As BAPISCHDLTable = New BAPISCHDLTable

Dim sddoc As String = Nothing

Dim tconvert As String = Nothing

Dim destination As New SAP.Connector.Destination()

destination.AppServerHost = "XXXXXX"

destination.Client = "XXX"

destination.Password = "XXX"

destination.SystemNumber = "XX"

destination.Username = "XX"

Dim partners As DataTable

partners = ordr_partners.ToADODataTable.Clone

Dim drDataRow As DataRow

drDataRow = partners.NewRow()

drDataRow("PARTN_ROLE") = "WE"

drDataRow("PARTN_NUMB") = "0000XXXXXX"

partners.Rows.Add(drDataRow)

For i As Integer = 0 To partners.Rows.Count - 1

ordr_partners.ToADODataTable.Rows.Add(partners.Rows(i).ItemArray)

Next

hdr.Sales_Org = "XXXX"

hdr.Distr_Chan = "20"

hdr.Division = "34"

hdr.Pmnttrms = "C001"

hdr.Doc_Type = "TA"

Dim connection As New SAP.Connector.SAPConnection(destination)

proxy.Connection = connection

proxy.Connection.Open()

Try

proxy.Bapi_Salesorder_Createfromdat2(Nothing, Nothing, tconvert, Nothing, Nothing, hdr, Nothing, sddoc, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, ordr_partners, Nothing, Nothing, Nothing, Nothing, Nothing)

Catch ex As System.IO.IOException

MsgBox(ex.InnerException)

End Try

proxy.Connection.Close()

Thanks

Sonal....

Edited by: Sonal Patel on Jun 18, 2010 10:14 AM

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Solved by myself