Skip to Content
author's profile photo Former Member
Former Member

Incoming Payment for Check example

anyone can give some exam regarding this?

thanks

Add a comment
10|10000 characters needed characters exceeded

Related questions

1 Answer

  • author's profile photo Former Member
    Former Member
    Posted on Jun 17, 2008 at 05:55 AM

    Erick,

    for payment is it as (example from help)

    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
    
       'Set the object's properties
       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 '5620.85
       vPay.CheckAccount = "280001"
       vPay.ContactPersonCode = 2
       vPay.DocCurrency = "Eur"
       vPay.DocDate = Now
       vPay.DocRate = 0
       vPay.DocTypte = 0
       vPay.HandWritten = 0
       vPay.JournalRemarks = "Incoming - D10004"
       vPay.LocalCurrency = 0
       vPay.Printed = 0
       vPay.Reference1 = 14
       vPay.Series = 0
       vPay.SplitTransaction = 0
       vPay.TaxDate = Now
       vPay.TransferAccount = "10100"
       vPay.TransferDate = Now
       vPay.TransferSum = 0 '
    
       vPay.Invoices.AppliedFC = 0
       vPay.Invoices.AppliedSys = 5031.2
       vPay.Invoices.DocEntry = 8
       vPay.Invoices.DocLine = 0
       vPay.Invoices.DocRate = 0
       vPay.Invoices.InvoiceType = it_Invoice
       vPay.Invoices.LineNum = 0
       vPay.Invoices.SumApplied = 5031.2
    
    
       vPay.Checks.AccounttNum = "384838"
       vPay.Checks.BankCode = "CB"
       vPay.Checks.Branch = "Branch"
       vPay.Checks.CheckNumber = 3838383
       vPay.Checks.CheckSum = 4031.2
       vPay.Checks.Currency = "Eur"
       vPay.Checks.Details = "test1"
       vPay.Checks.DueDate = CDate("31/12/2002")
       vPay.Checks.LineNum = 0
       vPay.Checks.Trnsfrable = 0
       Call vPay.Checks.Add
       Call vPay.Checks.SetCurentLine(1)
       vPay.Checks.AccounttNum = "384838"
       vPay.Checks.BankCode = "CB"
       vPay.Checks.Branch = "Branch"
       vPay.Checks.CheckNumber = "3838383"
       vPay.Checks.CheckSum = 1000
       vPay.Checks.Currency = "EUR"
       vPay.Checks.Details = "test2"
       vPay.Checks.DueDate = Now
       vPay.Checks.LineNum = 1
       vPay.Checks.Trnsfrable = 0
       If (vPay.Add() <> 0) Then
           MsgBox ("Failed to add a payment")
       End If
    
       'check for errors
       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
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      Petr,

      when i use CashSum = 0, it got an error too..i'll inform about it later coz this addon must finish quickly

      i use this code, and it work fine

      just a TRICK: when added .CheckAccount, it can't use HouseBank FormatCode, it must use AcctCode (the one with _Sysxxxxxxx) otherwise u'll receive an error "No Matching Record Found"

      .CardCode = ColCode2_UDS.ValueEx
                              .CardName = ColName2_UDS.ValueEx
                           
                              sHouseBank = ColAuAcc2_UDS.ValueEx
                              sHouseBank = Replace(sHouseBank, ".", "", , , CompareMethod.Text)
      
                              sSQL = "SELECT AcctCode FROM OACT WHERE FormatCode = '" & sHouseBank & "'"
                              oRs.DoQuery(sSQL)
                              .CheckAccount = oRs.Fields.Item(0).Value
      
                              oRs = oSBObob.Format_StringToDate(ColDate2_UDS.ValueEx)
                              .TaxDate = oRs.Fields.Item(0).Value
                              .DocDate = oRs.Fields.Item(0).Value
      
                              .DocType = SAPbobsCOM.BoRcptTypes.rCustomer
      
                              .HandWritten = SAPbobsCOM.BoYesNoEnum.tNO
                              .Series = 0
      
                              .Invoices.DocEntry = ColEntry2_UDS.ValueEx
                              .Invoices.InvoiceType = SAPbobsCOM.BoRcptInvTypes.it_Invoice
                              .Invoices.SumApplied = ColPaymen2_UDS.ValueEx
                              .Invoices.DiscountPercent = ColDisc2_UDS.ValueEx
      
      
                              .Checks.AccounttNum = ColAcc2_UDS.ValueEx
                              .Checks.CheckNumber = ColBilyet2_UDS.ValueEx
                              .Checks.CheckSum = ColAmount2_UDS.ValueEx
                              .Checks.DueDate = Today.Date
                              .Checks.Trnsfrable = 0

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.