Skip to Content

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

Outgoing Payment with journal Entry

Hi guys I need your help

I need to be able to do an outgoing payment based on a journal entry. This is my code but I get this error:

"Base document card & target document card do not match"

The journal is based on an incoming payment that was over paid and has a remaining balance.


            oOutPay.DocTypte = SAPbobsCOM.BoRcptTypes.rCustomer;
            oOutPay.CardCode = "CC0001";
            oOutPay.Invoices.DocEntry = 106; 
            oOutPay.Invoices.InvoiceType = SAPbobsCOM.BoRcptInvTypes.it_JournalEntry;

            oOutPay.TransferAccount = globals.bankTrAccOP;
            oOutPay.TransferSum = 80;

            int lRetCode;
            lRetCode = oOutPay.Add();

Former Member

Hi Costas,

In order to based the payment on Journal Entry,

You have to set the docline of the Payment to Journal Entry Line which has the same cardcode as your payment card code like this

oPay.Invoices.DocLine = oJE.Lines.Line_ID

What I do is I iterate through the Journal Entry to look for the line like this :

If .Invoices.InvoiceType = SAPbobsCOM.BoRcptInvTypes.it_JournalEntry _
                                    Or .Invoices.InvoiceType = SAPbobsCOM.BoRcptInvTypes.it_PaymentAdvice Then

    Dim oJE As SAPbobsCOM.JournalEntries
    oJE = oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oJournalEntries)
    For iLines As Integer = 0 To oJE.Lines.Count - 1
    If oJE.Lines.ShortName = .CardCode Then
    'If the line card equal payment card code, then assign the docline id
          oPay.Invoices.DocLine = oJE.Lines.Line_ID
          oJE = Nothing
          Exit For
     End If
End If

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