on 01-15-2004 1:19 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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
92 | |
11 | |
11 | |
6 | |
6 | |
4 | |
3 | |
3 | |
3 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.