cancel
Showing results for 
Search instead for 
Did you mean: 

Error adding Incoming Payments

Former Member
0 Kudos

hello all

I have a third party application, and I need to migrate incoming payments generated by that application. I read the headlines fit to be migrated to and through a loop trying to insert as many as required.

A payment can pay multiple invoices to a client. And this payment can be made partly in cash, another in check and another in credit card.

I had several error codes, but I will go for parts, first I get an error code (-10) and says it is an invalid document number in RCT2.DocEntry, reviewing SAP B1, if exist the invoice.


For i = 0 To dvMigrar.Count - 1
   Console.WriteLine(CType(dvMigrar(i)("Ingreso_Caja"), String) + " " + dvMigrar(i)("Recibo_de_Caja"))
   vPay.Series = oSeries.Series
   vPay.ApplyVAT = BoYesNoEnum.tNO
   vPay.CardCode = Trim(dvMigrar(i)("Cliente_No"))
   vPay.CashSum = 0
   vPay.DocCurrency = "USD"
   vPay.DocDate = dvMigrar(i)("Fecha")
   vPay.DocRate = 0
   vPay.DocTypte = 0
   vPay.HandWritten = 0
   vPay.JournalRemarks = "Ingreso desde POS - " & CStr(dvMigrar(i)("Recibo_de_Caja"))
   vPay.LocalCurrency = BoYesNoEnum.tYES
   vPay.TaxDate = Now

   'Migración de Detalle Facturas Pagadas
   SlctCmd = "SELECT * FROM DOC_ABONAR_POS WHERE Ingreso_Caja = " & dvMigrar(i)("Ingreso_Caja") 
   Dim SqlAdapter2 As OleDbDataAdapter = New OleDbDataAdapter(SlctCmd, MyConnSQL)
   dsMigrar2 = New System.Data.DataSet
   SqlAdapter2.Fill(dsMigrar2)
   Dim dvMigrar2 As DataView = New DataView(dsMigrar2.Tables(0))

   For j = 0 To dvMigrar2.Count - 1
      vPay.Invoices.Add()
      vPay.Invoices.DocEntry = dvMigrar2(j)("DocEntry")
      vPay.Invoices.InstallmentId = dvMigrar2(j)("No")
      vPay.Invoices.DocLine = j
      vPay.Invoices.InvoiceType = BoRcptInvTypes.it_Invoice
      vPay.Invoices.SumApplied = dvMigrar2(j)("Valor")
      vPay.Invoices.InvoiceType = BoRcptInvTypes.it_Invoice
   Next

   If (vPay.Add() <> 0) Then
      Console.WriteLine("No se pudo generar Pago")
      'Check Error
      Call vCompany.GetLastError(nErr, errMsg)
      If (0 <> nErr) Then
         Console.WriteLine("Error encontrado:" + Str(nErr) + "," + errMsg)
      End If
   End If
Next

I'm trying to pay several invoices at the same incoming payment

Thanks in advance

Edited by: Oscar Alberto Cornejo on Nov 14, 2011 11:20 AM

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

hi trying for this sample code.

Its working for me


     Dim blnNEWFirstRecord As Boolean = True                     
    For z As Integer = 0 To oSPRecSet.RecordCount - 1
                            oSalesPayments.Invoices.InvoiceType = SAPbobsCOM.BoRcptInvTypes.it_Invoice
                            oSalesPayments.Invoices.DocEntry = oSPRecSet.Fields.Item("DocEntry").Value
                            oSalesPayments.Invoices.SumApplied = oSPRecSet.Fields.Item("OpenAmount").Value
                            If Not blnNEWFirstRecord = True Then
                                oSalesPayments.Invoices.Add()
                            End If
                            blnNEWFirstRecord = False
                            oSPRecSet.MoveNext()
                        Next

 oPaymentError = oSalesPayments.Add()

Answers (2)

Answers (2)

0 Kudos

I'm having the same problem, do you have any solution for this or what is the source of it?

Best Regards.

Former Member
0 Kudos

Hello

I made ​​a mistake in the first loop, I defined the object payment outside the loop, must be within the loop.

thanks for your help.