cancel
Showing results for 
Search instead for 
Did you mean: 

Clearing an Invoice using the DI

Former Member
0 Kudos

Hello

I am experiencing a problem when I generate a Journal Credit that is matched to a invoice using the DI but the balance on the invoice does not reduce or clear. I am using the following code:

' Generate the Excess Invoice/Document

oJournal = oDICompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oJournalEntries)

oJournal.TaxDate = Now

oJournal.Memo = "Excess-" & oCustName.Value

oJournal.Reference = lDocNum

oJournal.Lines.AccountCode = sGLTradeAcc

oJournal.Lines.ContraAccount = oCustAcc.Value

oJournal.Lines.ShortName = oCustAcc.Value

oJournal.Lines.Debit = rExcAmt

oJournal.Lines.Credit = 0

oJournal.Lines.ReferenceDate1 = Now

oJournal.Lines.LineMemo = "Excess-" & oCustName.Value

oJournal.Lines.Reference1 = lDocNum

oJournal.Lines.Add()

oJournal.Lines.AccountCode = sGLTradeAcc

oJournal.Lines.TaxDate = Now

oJournal.Lines.ContraAccount = oInvParty.Value

oJournal.Lines.ShortName = oInvParty.Value

oJournal.Lines.Credit = rExcAmt

oJournal.Lines.Debit = 0

oJournal.Lines.ReferenceDate1 = Now

oJournal.Lines.LineMemo = "Excess-" & oCustName.Value

oJournal.Lines.Reference1 = lDocNum

oJournal.Lines.Add()

If (0 <> oJournal.Add()) Then

MsgBox("failed to add a journal entry")

Call oDICompany.GetLastError(nErr, ErrMsg)

If (0 <> nErr) Then

MsgBox("Found error:" + Str(nErr) + "," + ErrMsg)

End If

End If

oJournal = Nothing

Please help !

Regards

John

Accepted Solutions (1)

Accepted Solutions (1)

former_member185703
Active Contributor
0 Kudos

Hi John,

You can only "clear" (= "Close"?!) an Invoice by posting a Payment or a Credit Memo, if I am not totally wrong!

A Journal entry only has a connection to a document (through the Origin / Origin No. fields) when it is generated in the background of the document creation!

Sorry, Frank

Answers (0)