Skip to Content

Payment on Account with no invoice


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.


Add a comment
10|10000 characters needed characters exceeded

Related questions

2 Answers

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on May 05, 2011 at 11:20 AM


    Please search direct code in help book

    C:\Program Files\sap\SAP Business One SDK\Help

    Keyword as "Incoming Payment"

    You will find many code that match your need



    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on May 05, 2011 at 10:17 AM

    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)
           MsgBox ("Succeed in payment.add")
       End If
       'disconnect the company object, and release resource
       Call vCompany.Disconnect
       Set vCompany = Nothing
       Exit Sub
       MsgBox ("Exception:" + Err.Description)
    End Sub

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.