Hi Mike
how was it code?
I'm trying
IF oOrder.GetByKey(BaseEntry) = True Then Dim oInvoices As SAPbobsCOM.Documents = oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oPurchaseInvoices) oInvoices.CardCode = oOrder.CardCode oInvoices.CardName = oOrder.CardName oInvoices.DocDate = oOrder.DocDate oInvoices.DocDueDate = oOrder.DocDueDate oInvoices.DocCurrency = oOrder.DocCurrency i = 0 While i < oOrder.Lines.Count IF i <> 0 Then oInvoices.Lines.Add() End IF oOrder.Lines.SetCurrentLine(i) oInvoices.Lines.BaseEntry = oOrder.DocEntry oInvoices.Lines.BaseLine = oOrder.Lines.LineNum oInvoices.Lines.BaseType = 22 oInvoices.Lines.WarehouseCode = oOrder.Lines.WarehouseCode oInvoices.Lines.TaxCode = oOrder.Lines.TaxCode i += 1 End While oInvoices.DocDueDate = Date.Today Retval = oInvoices.Add If Retval <> 0 Then MsgBox( "Error: " & oCompany.GetLastErrorDescription()) Else MsgBox(String.Format(" {0} Items", i)) End If End IF
get an error: Item number is missing; specify an item number [PCH1.ItemCode][line: 5]
thanks!