on 2005 Nov 07 9:39 AM
Hi all,
I have serious problem with creating Credit Note based on existing A/R Invoice in Sales module.
I use SBO 2004A patch level 32. With SDK I've created A/R Invoice with 2 items. First item has discount percent 0% and price after VAT 1. Second item has 100% discount, this means, doctotal is 1. Document VAT is 7,6% and VAT is calculated correctly in invoice. Then I've created credit note only with 1 item and this row is bounded with 1 row in invoice. After calling oCreditNote.Add, in Business One this credit note has all prices (price, price after VAT, row total) with the same value -> there is no vat calculated although in invoice the vat calculated is.
Is it bug in DI API or do I something wrong?
I use the standard ways to create new invoice and credit note through DI API.
Many thanks for your answers.
Best regards
Libor.
Hi Libor,
To create a Credit note for a Invoice you should use the Invoice as the base document for the Credit note. Here is an example of how I create a GRPO from a draft GRPO. Try this (for your Invoice - Credit Note) and see if it does not work for you (SAP suggests this way of doing it).
(Draft will be your invoice - GRPO will be your credit note)
Dim oDraft As SAPbobsCOM.Documents
Dim oGRPO As SAPbobsCOM.Documents
If oDraft.GetByKey(YourInvoiceNumber) Then
'Build the GRPO (new GRPO Obj for each GRPO Doc)
oGRPO = oComp.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oPurchaseDeliveryNotes)
oGRPO.DocDate = oDraft.DocDate
oGRPO.DocDueDate = oDraft.DocDueDate
oGRPO.DiscountPercent = oDraft.DiscountPercent
oGRPO.CardCode = oDraft.CardCode
For i = 0 To oDraft.Lines.Count - 1
oDraft.Lines.SetCurrentLine(i)
oGRPO.Lines.BaseType = oDraft.Lines.BaseType
oGRPO.Lines.BaseEntry = oDraft.Lines.BaseEntry
oGRPO.Lines.BaseLine = oDraft.Lines.BaseLine
If i < oDraft.Lines.Count - 1 Then
oGRPO.Lines.Add()
End If
Next i
'Add the GRPO
iRetCode = oGRPO.Add
If iRetCode <> 0 Then
oComp.GetLastError(iRetCode, sErrMsg)
Log.WriteLog("Error Adding GRPO : " & sErrMsg, EventLogEntryType.Warning)
Return False
End If
End If
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Barend,
thanks for your answer. I found the solution, but I don't know, if it is bug in SDK, but immediately, when I filled some user-fields in credit note or other fields with some values (or the same as invoice) and then I bound row in credit note with row in invoice, then the credit note doesn't calculate VAT, although there is VAT group f.e. A1 and VAT percentage 7,6% in row.
When I filled this credit note only with CardCode and bound the rows, then the VAT is calculated (or copied from invoice) correctly.
Best regards
Libor.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
102 | |
9 | |
7 | |
6 | |
4 | |
3 | |
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.