Skip to Content
author's profile photo Former Member
Former Member

About Invoice

Hello to all, I have the following problem, when I try to add an invoice, the following error shows up: -5002 Update quantity to Purchase Order?

some suggestion for correcting the problem?

Add comment
10|10000 characters needed characters exceeded

2 Answers

  • Posted on Jan 16, 2004 at 02:01 PM

    The error occurs because the last line added to the invoice was an empty line.

    When you create a new Documents object, it already has a line on it. Do not call Document_Lines.Add until you are ready to add the second line. Do not call Document_Lines.Add after the last line has been added to the invoice.

    THIS WILL WORK:

    Set oInvoice = vCmp.GetBusinessObject(oInvoices)

    Set oInvLines = oInvoice.Lines

    oInvoice.CardCode = txtCustCode

    oInvoice.DocDate = Date

    oInvoice.DocDueDate = Date

    'set properties on the first line of the invoice

    oInvLines.ItemCode = "A00001"

    oInvLines.Quantity = 5

    'add an empty line to the invoice, then set properties on it

    oInvLines.Add

    oInvLines.ItemCode = "A00002"

    oInvLines.Quantity = 3

    'comment: if you add another line just before you add the invoice, it will cause the error

    retval = oInvoice.Add

    Add comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jan 16, 2004 at 03:51 PM

    I am a developer and I do not know too much about the business logic underneath SAP Business One.

    This sounds as if the invoice you tried to create was linked to an order document. When you tried to add the invoice, the quantity of the item did not match the quantity given in the related order?

    Just guessing.

    HTH Lutz Morrien

    Add comment
    10|10000 characters needed characters exceeded