Skip to Content
0
Apr 17, 2012 at 11:59 PM

Outgoing payments against AR Credit Memos

171 Views

I am trying to create an outgoing payment against an existing open AR Credit Memo. Here's my code - getting "No matching records found". Note that the payment is applied against 1 AR credit memo and it consists of two credit card entries (ignore cc numbers and exp dates)

Please let me know what I am doing wrong. Thanks!

Dim creditMemoDocentry as Integer

creditMemoDocentry=445 'this is the docentry of the credit memo

oPmt = vCmp.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oVendorPayments)

oPmt.DocType = SAPbobsCOM.BoRcptTypes.rCustomer
oPmt.DocObjectCode = SAPbobsCOM.BoPaymentsObjectType.bopot_OutgoingPayments
oPmt.CardCode = "C1234"
oPmt.DocDate = docDate
oPmt.DueDate = docDate

oPmt.CashSum = 100
oPmt.CashAccount = "_SYS00000000001" '// this is my cash account - I

'oPmt.Invoices.Add() //Note - this line is commented out.
oPmt.Invoices.InvoiceType = SAPbobsCOM.BoRcptInvTypes.it_CredItnote
oPmt.Invoices.DocEntry = creditMemoDocentry


oPmt.Invoices.DocLine = 0


'Adding credit cards
oPmt.CreditCards.CreditCard = 2
oPmt.CreditCards.CreditCardNumber = "12345"
oPmt.CreditCards.CardValidUntil = Month(Now) & "/" & Year(Now)
oPmt.CreditCards.VoucherNum = "0"
oPmt.CreditCards.CreditSum = 20

oPmt.CreditCards.Add()
oPmt.CreditCards.CreditCard = 3
oPmt.CreditCards.CreditCardNumber = "12345"
oPmt.CreditCards.CardValidUntil = Month(Now) & "/" & Year(Now)
oPmt.CreditCards.VoucherNum = "0"
oPmt.CreditCards.CreditSum = 32

If oPmt.Add() <> 0 Then
Call vCmp.GetLastError(nErr, errMsg)
If (0 <> nErr) Then
MsgBox("Error creating Ougoing Payment ex: " & nErr & " " & errMsg)
End If

End If