Hi,
I would like to create an incoming payment on a customer. I want the incoming payment "Payment on Account", with no invoice. In the tables these fields are "PayNoDoc" and "PayNoSum". How do I do this with the SDK?
I know how to create an incoming payment with an invoice, but I get an error if I try and do it without one.
Thanks
It's covered in the SDK help under "Payments Object". This adds a payment, with two payment methods (Cash and Bank Transfer) as a payment on account.
If you get an error running this code, please post the error message - if this is supplied in the help file, it should work without error!
Private Sub cmdTest_Click() On Error GoTo ErrorHandler Dim vCompany As SAPbobsCOM.Company 'create company object Set vCompany = New SAPbobsCOM.Company 'set paras for connection vCompany.CompanyDB = "SBODemo_US" vCompany.Password = "manager" vCompany.UserName = "manager" vCompany.Server = "(local)" 'connect to database server If (0 <> vCompany.Connect()) Then MsgBox "Failed to connect" Exit Sub End If Dim nErr As Long Dim errMsg As String 'do it now Dim vPay As SAPbobsCOM.Payments Set vPay = vCompany.GetBusinessObject(oIncomingPayments) vPay.Address = "622-7" vPay.ApplyVAT = 1 vPay.CardCode = "D10006" vPay.CardName = "Card D10004" vPay.CashAccount = "288000" vPay.CashSum = 0 'vPay.CheckAccount = "280001" vPay.ContactPersonCode = 1 vPay.DocCurrency = "Eur" vPay.DocDate = Now vPay.DocRate = 0 vPay.DocTypte = 0 vPay.HandWritten = 0 vPay.JournalRemarks = "Incoming - D10004" vPay.LocalCurrency = tYES vPay.Printed = 0 vPay.Reference1 = 8 vPay.Series = 0 vPay.SplitTransaction = 0 vPay.TaxDate = Now vPay.TransferAccount = "10100" vPay.TransferDate = Now vPay.TransferSum = 5031.2 If (vPay.Add() <> 0) Then MsgBox ("Failed to add a payment") End If 'Check Error Call vCompany.GetLastError(nErr, errMsg) If (0 <> nErr) Then MsgBox ("Found error:" + Str(nErr) + "," + errMsg) Else MsgBox ("Succeed in payment.add") End If 'disconnect the company object, and release resource Call vCompany.Disconnect Set vCompany = Nothing Exit Sub ErrorHandler: MsgBox ("Exception:" + Err.Description) End Sub
Add a comment