Skip to Content
0
Former Member
Aug 01, 2016 at 02:57 PM

Advice required for creation of sales BOM via DI-API

494 Views

I'm struggling to create a Sales BOM item. The issue seems to reside around the current line for the BOM items.

I'm iterating the number of lines to add, the first line (where SetCurrentLine(0) is evaluated) passes without error but subsequent lines generate an error.

Dim TREE As ProductTrees = foCompany(DB).GetBusinessObject(BoObjectTypes.oProductTrees)
TREE.TreeCode = row("BOM_PARENT")
TREE.TreeType = BoItemTreeTypes.iSalesTree
TREE.Warehouse = "09"
For intBOMrow = 0 To tds.Tables(0).Rows.Count - 1
TREE.Items.SetCurrentLine(intBOMrow)
TREE.Items.ParentItem = row("BOM_PARENT")
    TREE.Items.ItemCode = row("LINE_SKU")
    TREE.Items.Quantity = row("LINE_QTY")
    TREE.Items.Warehouse = row("LINE_WHS")
    TREE.Items.Add()
Next

The error just reads the message "Invalid row" and provides no error number. Any guidance would be appreciated