Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Clearing an Invoice using the DI

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

Former Member
replied

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

0 View this answer in context
Not what you were looking for? View more on this topic or Ask a question