on 05-16-2006 10:46 AM
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
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
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.