on 11-22-2004 9:37 AM
Hi everybody.
I am trying to create an invoice in the delivery screen, but i am getting an error "-5002 Invalid total[OINV.DocTotal]". Can anyone tell me how to solve this ?
here is my code
Dim sNewObjCode As String
Dim i As Integer
' Get last added document number (the order that was added)
oCompany.GetNewObjectCode(sNewObjCode)
' this loop adds the different items to the invoice object
i = 0
Do
oInvoice.Lines.BaseEntry = sNewObjCode
oInvoice.Lines.BaseLine = i
oInvoice.Lines.BaseType = SAPbobsCOM.BoObjectTypes.oOrders
oInvoice.Lines.TaxCode = TableLines.Rows(i).Item(4)
i += 1
If i <> TableLines.Rows.Count Then
oInvoice.Lines.Add()
End If
Loop Until i = TableLines.Rows.Count
' Try to add the invoice object to the database
lRetCode = oInvoice.Add()
If lRetCode <> 0 Then ' If the addition failed
oCompany.GetLastError(lErrCode, sErrMsg)
MsgBox(lErrCode & " " & sErrMsg) ' Display error message
Else
cmdInvoice.Enabled = True
MsgBox("inv Added to DataBase", MsgBoxStyle.Information, "Order Added")
End If
Thanks
Mina
Mina,
You have to fill the mandatory fields of the invoice
oInvoice.CardCode = oDelivery.CardCode
oInvoice.DocTotal = oDelivery.DocTotal
oInvoice.HandWritten = tNO
oInvoice.DocDate = oDelivery.DocDate
Regards,
Edwin van Kwikkelberghe
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I suppose the Invoice amount total is 0 and then SBO doesn´t allow you to add it. The same happens when you create an Invoice using the GUI.
I think you must add the price to the lines.
Regards,
Ibai Peñ
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
107 | |
12 | |
11 | |
6 | |
5 | |
4 | |
4 | |
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.