cancel
Showing results for 
Search instead for 
Did you mean: 

Incoming Payment for Check example

Former Member
0 Kudos

anyone can give some exam regarding this?

thanks

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

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

Former Member
0 Kudos

thanks Petr,

i noticed the example after i post

still doesn't understand it though because the example use this line

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

while i'm just using Checks, it is suppose to be just use this line?

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

i'm still trying it,

Former Member
0 Kudos

Erick,

I suggest to set only properties which you set with manualy doing payment in SBO. Try to add payment in SBO manualy and the same values fill in object.

Former Member
0 Kudos

ok Petr,

i wil try it first...

Former Member
0 Kudos

confuse,

this is the one i use but i received error no matching records found?

why?

.CardCode = ColCode2_UDS.ValueEx
.CardName = ColName2_UDS.ValueEx
.CashSum = 0 'ColAmount2_UDS.ValueEx

.CheckAccount = ColAuAcc2_UDS.ValueEx

                        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

                      

                        .Invoices.DocEntry = ColEntry2_UDS.ValueEx
                 
                        .Invoices.InvoiceType = SAPbobsCOM.BoRcptInvTypes.it_Invoice
                       
                        .Invoices.SumApplied = ColTotal2_UDS.ValueEx


                        .Checks.AccounttNum = ColAcc2_UDS.ValueEx
                        .Checks.BankCode = "BCA"
                        .Checks.CheckNumber = ColBilyet2_UDS.ValueEx
                        .Checks.CheckSum = ColAmount2_UDS.ValueEx
                        .Checks.DueDate = Today.Date
                        .Checks.Trnsfrable = 0

Former Member
0 Kudos

What I suggest is to use .Series = 0 for setting series when you dont use handwritten docnum.

The error seems, that you set something what doesnt exists in sap. Check, if the .Checks.CheckNumber exists in db, or try add record with hard values and see, what happens.

Former Member
0 Kudos

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