cancel
Showing results for 
Search instead for 
Did you mean: 

outgoing payments(account) via DI API SDK

Jdonis2002
Explorer
0 Kudos

Hey everyone, I'm trying to create an outgoing payment to an account, but I'm getting this error "[OCRD] , 'No matching records found (ODBC -2028)'"

I've completed the required fields to reduce the chance of errors, and also checks these based on my last payment.

' oPays.GetByKey (2)

these's my code,

Dim oPays As New SAPbobsCOM.Payments

Set oPays = oCom.GetBusinessObject(oVendorPayments)

oPays.AccountPayments.AccountCode = "_SYS00000000031"

oPays.AccountPayments.AccountName = "Juan Perez"

oPays.AccountPayments.Decription = "Pago Manual"

oPays.AccountPayments.SumPaid = 250

oPays.CardCode = "_SYS00000000031"

oPays.CardName = "Juan Perez"

oPays.DocObjectCode = bopot_OutgoingPayments

oPays.DocType = rAccount

oPays.DocTypte = rAccount

oPays.DocCurrency = "QTZ"

oPays.DocDate = "30/01/2006"

oPays.IsPayToBank = tNO

oPays.JournalRemarks = "pag efect"

oPays.LocalCurrency = tNO

oPays.PaymentPriority = bopp_Priority_6

oPays.Series = 10

oPays.TaxDate = "30/01/2006"

oPays.TransferAccount = "_SYS00000000025"

oPays.TransferDate = "30/01/2006"

oPays.TransferReference = "ref01"

oPays.TransferSum = 250

oPays.ApplyVAT = tNO

oPays.HandWritten = tNO

oPays.Proforma = tNO

oPays.DocNum = 3

oPays.AccountPayments.Add

oPays.Add

If oCom.GetLastErrorCode <> 0 Then

Debug.Print oCom.GetLastErrorDescription

End If

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Jorge,

Are you sure the "_SYS00000000031" BP exists?

If it exists you don´t have to say that the CardName is "Juan Perez", as it will filled automatically.

Are you sure that "Juan Perez" is a valid CardName. What I guess is that one of those fields is not OK, and thats the error´s reason.

PS: Try debugging with some try catch blocks, and reducing the lines where the code could be.

Hope helps,

Ibai Peñ

Jdonis2002
Explorer
0 Kudos

Hi Ibai,

Thanks for your help,

I comment the line CardName how do you say to try and I still have the same error.

I Checked the CardCode and it exists in [OACT].

I used try-catch in VB.NET and there was not error catched. The error raise from SAP when execute opays.ADD .

anything else do you thing that I've to try.

allways thanks,

former_member184566
Active Contributor
0 Kudos

Hi Jorge

I've looked at your code, obviously i can't use it on my end exactly because my database is different. But looking at your code i see you add code that is not always neccasery. For instance, why do you need a bp if you're making an outgoing payment of account type (only need gl's). Also the things like docnum and so on is not neccasery because sap will allocate itself the next number, but if you want it in a certain series then stipulate just the series.

I've taken your code, i've taken out certain lines to see if it works on my side. It works perfectly. I'd suggest you copy the code and see if it works on your side. if it does then do all your extra lines one at a time until you get the error, narrow it down. Both my gl accounts are the same, just did this for simplicity but in real life it will be different accounts.

Dim oPays As SAPbobsCOM.Payments

oPays = oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oVendorPayments)

oPays.AccountPayments.AccountCode = "_SYS00000000420"

'oPays.AccountPayments.AccountName = "Juan Perez"

oPays.AccountPayments.Decription = "Pago Manual"

oPays.AccountPayments.SumPaid = 250

'oPays.CardCode = "ADA001-S" '"_SYS00000000031"

'oPays.CardName = "Juan Perez"

oPays.DocObjectCode = SAPbobsCOM.BoPaymentsObjectType.bopot_OutgoingPayments

oPays.DocType = SAPbobsCOM.BoRcptTypes.rAccount

oPays.DocTypte = SAPbobsCOM.BoRcptTypes.rAccount

'oPays.DocCurrency = "USD"

oPays.DocDate = Now

'oPays.IsPayToBank = tNO

oPays.JournalRemarks = "pag efect"

'oPays.LocalCurrency = tNO

'oPays.PaymentPriority = bopp_Priority_6

'oPays.Series = 10

oPays.TaxDate = Now

oPays.TransferAccount = "_SYS00000000420"

oPays.TransferDate = Now

oPays.TransferReference = "ref01"

oPays.TransferSum = 250

oPays.ApplyVAT = SAPbobsCOM.BoYesNoEnum.tNO

'oPays.HandWritten = SAPbobsCOM.BoYesNoEnum.tNO

'oPays.Proforma = SAPbobsCOM.BoYesNoEnum.tNO

'oPays.DocNum = 3

oPays.AccountPayments.Add()

If oPays.Add() <> 0 Then

MsgBox(oCompany.GetLastErrorDescription)

End If

' If oCompany.GetLastErrorCode <> 0 Then

'Debug.Print(oCom.GetLastErrorDescription)

'End If

Hope this helps

former_member184566
Active Contributor
0 Kudos

Oh, i also changed Dim oPays As New SAPbobsCOM.Payments

to Dim oPays As SAPbobsCOM.Payments. It wouldn't work with it your way on my side.

Jdonis2002
Explorer
0 Kudos

I cant belived, but it's working,

thanks for you answer.

pst. I enabled the cardname and still working.

😃

many thanks,

former_member184566
Active Contributor
0 Kudos

not a problem, just glad it helped. I also tried the card name and strange enough it did work.....but it shouldn't theoretically.

But glad it works.

😃

Former Member
0 Kudos

Greats....

I've tried to implement the solution that you expose for adding an Outgoing Payment (Account Type) but I get the Error: 4006 without Description and I'm trying to figure out if it´s because the version of SBO. Mine is "SAP BO 2005 A (6.80.124) SP: 00 PL:10".

I appreciate any suggestions.

Former Member
0 Kudos

I tested with "Service Pack 1 PL:10" and works fine!!!!

Former Member
0 Kudos

Hi Louis,

This is the code to save Bank Transfer but how about if this is a check? THanks

Answers (0)