create sales order using VB.net and Axapta Business Connector

Hi All,

as the title says i am trying to create a sales order using .net business connector (VB) here is the code snippet:

Try

If MsgBox(“Upload SO record to Axapta?”, MsgBoxStyle.YesNo, “System Message”) = MsgBoxResult.Yes Then
’ Sales Order Header
salesHeader = ax.CreateAxaptaObject(“AxSalesTable”)
salesHeader = salesHeader.Call(“construct”)
salesHeader.Call(“parmCustAccount”, “C-FG0001”)
salesHeader.Call(“save”)

’ Sales Order Lines
salesLine = ax.CreateAxaptaObject(“AxSalesLine”)
Dim sid As String = salesHeader.Call(“parmSalesID”).ToString
salesLine.Call(“parmSalesID”, sid)
salesLine.Call(“parmItemId”, “5S-ACOBOA010”)
salesLine.Call(“parmInventDimId”, “10”)
’ Dimensions/Warehouse

salesLine.Call(“save”)
MsgBox(“SO Uploaded!”)
End If
Catch ex As Exception
MsgBox(ex.Message)
End Try

works find but i cant seem to fill in the field warehouse thus i get an error

“Inventory Dimension Site is mandatory”

of course im pretty new with Axapta development specially using .net business connector so pardon the question. hope somebody could help out. thanks a lot :slight_smile:

j

any input guys?

use dataset and access item like this

ds.Tables(0).Rows(i).Item(0)

http://vb.net-informations.com/dataset/dataset-sqlserver.htm

ling

Hi RJ,

From error message, it appears that the InventDimID that you are sending is incorrect. Please correct the same.

Also if you haven’t already done so, try to create sales order manually in AX using this data.