Hi Ad,
oCompany.StartTransaction()
Dim errCount AsInteger = 0
Dim successCount AsInteger = 0
Try
Dim oInvoice As SAPbobsCOM.Documents = oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oInvoices)
Dim oInvoiceDetails As SAPbobsCOM.Document_Lines = oInvoice.Lines
'SET HEADER
With oInvoice
.DocDate = Date.Today
.NumAtCard = "CIN00019"
.DocType = BoDocumentTypes.dDocument_Service
.DocTotal = "600"
.CardCode = "AC-Cash"
EndWith
'SET DETAILS
With oInvoiceDetails
.ItemDescription = "Line"
.AccountCode = "_SYS00000000010"
.LineTotal = "600"
.VatGroup = "OVAT-S"
.Add()
EndWith
IfNot oInvoice.Add = 0 Then
If oCompany.InTransaction Then oCompany.EndTransaction(SAPbobsCOM.BoWfTransOpt.wf_RollBack)
errCount += 1
MessageBox.Show(oCompany.GetLastErrorDescription)
Return successCount.ToString + "|" + errCount.ToString
EndIf
Dim cash AsDecimal = 0
Dim acct AsString = Nothing
Dim oInvEntry AsInteger = oCompany.GetNewObjectKey
Dim oPayments As SAPbobsCOM.Payments = oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oIncomingPayments)
oPayments.DocType = SAPbobsCOM.BoRcptTypes.rCustomer
oPayments.CardCode = "AC-Cash"
oPayments.DocDate = Date.Today
oPayments.DocObjectCode = SAPbobsCOM.BoPaymentsObjectType.bopot_IncomingPayments
oPayments.Invoices.InvoiceType = SAPbobsCOM.BoRcptInvTypes.it_Invoice
oPayments.Invoices.DocEntry = oInvEntry
oPayments.CashSum = "600"
'oPayments.CashAccount = "_SYS00000000010"
oPayments.Invoices.Add()
IfNot oPayments.Add = 0 Then
If oCompany.InTransaction Then oCompany.EndTransaction(SAPbobsCOM.BoWfTransOpt.wf_RollBack)
errCount += 1
MessageBox.Show(oCompany.GetLastErrorDescription)
Return successCount.ToString + "|" + errCount.ToString
successCount += 1
EndIf
Catch ex As Exception
MessageBox.Show(ex.ToString)
EndTry
Return successCount.ToString + "|" + errCount.ToString
If oCompany.InTransaction Then oCompany.EndTransaction(SAPbobsCOM.BoWfTransOpt.wf_Commit)
While debugging in .NET, the debug mode exits on the line oPayments.Add.