HOWTO - Создание счета на закупку в SAP Business One с помощью SDK - PullRequest
0 голосов
/ 20 июня 2019

Я получаю сообщение об ошибке при создании счета-фактуры с использованием SAP Business One 9.3 SDK.

Ошибка 5009 - Номер позиции отсутствует.

enter image description here

Код здесь

                '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

Любая помощь с благодарностью.

С уважением

Джеймс О'Догерти Решения и архитектор баз данных WinSQL Development Ltd

...