cancel
Showing results for 
Search instead for 
Did you mean: 

Generar Letra de cambio por API desde visual basic

Former Member
0 Kudos

Hola a todos, es mi primera visita en este foro, y necesito una gran ayuda.

Estoy creando un programa externo en visual basic que enlaza informacíon desde SAP BO, y tengo que consultar las facturas impagas y cancelarlas con letras de cambio, para eso utilizo la DI API, al generar el pago con cualquier otro tipo de pago me resulta perfecto, pero el problema es al utilizar letras de cambio.

Para ello utilizo el objeto BillOfExchange, al momento de grabar, crea el pago en SAP BO, rebaja el saldo,pero con medio de pago en efectivo.

Este es el codigo que utlizo.

Dim vPay As SAPbobsCOM.Payments

Set vPay = oCompany.GetBusinessObject(oIncomingPayments)

vPay.BankAccount = "_SYS00000000001"

vPay.BankCode = 800

vPay.CardCode = "XXXXX"

vPay.CashSum = 123456

vPay.DocDate = Now

vPay.JournalRemarks = "Pago recibido - XXXXX"

vPay.Reference1 = "22949"

vPay.Invoices.DocEntry = 22949

vPay.Invoices.DocLine = 1

vPay.Invoices.InvoiceType = it_Invoice

vPay.Invoices.SumApplied = 1000

Call vPay.Invoices.Add

vPay.BillOfExchange.PaymentMethodCode = "BOE"

vPay.BillOfExchange.BPBankAct = "LETRA"

vPay.BillOfExchange.BPBankCode = 800

vPay.BillOfExchange.BPBankCountry = "CL"

vPay.BillOfExchange.BillOfExchangeDueDate = Now

vPay.BillOfExchange.BillOfExchangeNo = 92561

vPay.BillOfExchange.Details = "Letra 92561"

vPay.BillOfExchange.PaymentEngineStatus1 = "C"

vPay.BillOfExchange.ReferenceNo = "1/1"

vPay.BillOfExchange.Remarks = "aa"

vPay.BillOfExchange.StampTaxAmount = 1000

vPay.BillOfExchange.StampTaxCode = ""

If (vPay.Add() <> 0) Then

MsgBox "Error al agregar pago", vbExclamation, szTituloAplicacion

End If

'Check Error

Call oCompany.GetLastError(lErrCode, sErrMsg)

If (0 <> lErrCode) Then

MsgBox "Error encontrado:" + Str(lErrCode) + "," + sErrMsg

Else

MsgBox "Pago satisfactorio"

End If

Por favor si alguién ha trabajado con este tipo de objeto, le agradecería mucho la ayuda.

PD: esto es para SAP BO 2007A (Chile)

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hola Carolina, puedes probar este código, esto funciona siempre y cuando tengas paramerizado tanto los bancos del socio de negocios, las cuentas asociadas, los metodos de pago que asocias al socio de negocios.

 
oPagoRecibido = oSBO_Company.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oIncomingPayments)

oIP.DocType = SAPbobsCOM.BoRcptTypes.rCustomer
oIP.LocalCurrency = SAPbobsCOM.BoYesNoEnum.tNO
oIP.CashSum = 0
oIP.HandWritten = SAPbobsCOM.BoYesNoEnum.tNO
oIP.CardCode = _CardCode
oIP.Address = _Direccion

oIP.DocDate = _Now
oIP.DueDate = _DueDate
oIP.Remarks = "Remarks"
oIP.JournalRemarks = "JournalRemarks"
oIP.BillOfExchangeAmount = _BoeSum


_BillofExchangeStatus = SAPbobsCOM.BoBoeStatus.boes_Sent
ó
_BillofExchangeStatus = SAPbobsCOM.BoBoeStatus.boes_Created

oIP.BillofExchangeStatus = _BillofExchangeStatus

oBOE = oIP.BillOfExchange
oBOE.BPBankCountry = _Pais
oBOE.BPBankCode = _Banco
oBOE.BPBankAct = _Cuenta
oBOE.PaymentMethodCode = _MetodoPago
oBOE.BillOfExchangeDueDate = _DueDate
oBOE.ReferenceNo = "ReferenceNo"

oIP.Invoices.SetCurrentLine(oPagoRecibido.Invoices.Count - 1)
oIP.Invoices.DocEntry = _Factura.DocEntry
oIP.Invoices.InvoiceType = _Factura.Objeto  -- 13 factura, 14 Nota de Credito, etc
oIP.Invoices.InstallmentId = _Factura.Cuota
oIP.BillOfExchange.BillOfExchangeNo = _NextBoeNum

oIP.Invoices.SumApplied = _SumApplied
ó
oIP.Invoices.AppliedFC = _AppliedFC

oIP.Add()

Espero que esto te ayude.

Saludos

George

Answers (1)

Answers (1)

Former Member
0 Kudos

Muchas gracias George, tu ayuda me sirvió de mucho.

Saludos