使用SAP Business One 9.3 SDK创建采购发票时出错。
错误是5009-物品编号缺失。
代码在这里
'create purchase invoice document
Dim oPurchaseInvoice As Documents
oPurchaseInvoice = oCompany.GetBusinessObject(BoObjectTypes.oPurchaseInvoices)
If Not dtAP Is Nothing Then
If dtAP.Rows.Count > 0 Then
With oPurchaseInvoice
.BPL_IDAssignedToInvoice = 1
.CardCode = dtAP.Rows(0)("card_code")
.NumAtCard = dtAP.Rows(0)("card_code")
.DocType = BoDocumentTypes.dDocument_Items
.DocNum = txtDocumentNumberPrefix.Text.Trim + uneNextDocumentNumber.Value.ToString.Trim
.Reference1 = txtDocumentNumberPrefix.Text.Trim + uneNextDocumentNumber.Value.ToString.Trim
.Reference2 = dtAP.Rows(0)("travel_invoice_no")
.DocCurrency = dtAP.Rows(0)("currency_code")
.DocDate = dtAP.Rows(0)("travel_invoice_date")
.DocDueDate = dtAP.Rows(0)("travel_invoice_due_date")
.DocTotal = dtAP.Rows(0)("total_gross_amount_ccy")
.HandWritten = BoYesNoEnum.tNO
.Series = dtAP.Rows(0)("series")
.Lines.ItemCode = "0"
.Lines.AccountCode = dtAP.Rows(0)("sap_expense_code").ToString
If dtAP.Rows(0)("travel_invoice_item_description").ToString.Length > 50 Then
.Lines.ItemDescription = dtAP.Rows(0)("travel_invoice_item_description").ToString.Substring(0, 49)
Else
.Lines.ItemDescription = dtAP.Rows(0)("travel_invoice_item_description").ToString
End If
.Lines.Quantity = 1
.Lines.DiscountPercent = 0.0
.Lines.Currency = dtAP.Rows(0)("currency_code")
If Not IsDBNull(dtAP.Rows(0)("total_net_amount_ccy")) Then
.Lines.Price = dtAP.Rows(0)("total_net_amount_ccy")
.Lines.LineTotal = dtAP.Rows(0)("total_net_amount_ccy")
End If
If Not IsDBNull(dtAP.Rows(0)("project_code")) Then
.Lines.ProjectCode = dtAP.Rows(0)("project_code")
End If
'TFS1837 - VAT lines
If Not IsDBNull(dtAP.Rows(0)("sap_vat_code")) Then
.Lines.TaxCode = dtAP.Rows(0)("sap_vat_code")
End If
'.Lines.Add()
End With
End If
任何帮助都将不胜感激。
致谢
James O'Doherty 解决方案和数据库架构师 WinSQL Development Ltd