Skip to Content
0
Former Member
Nov 21, 2006 at 03:40 AM

Incoming Payment error

55 Views

Hi, everyone

I was trying to create incoming payment with DI API.

Credit card payment works fine.

But cash and checks payments failed with 'General observer error" message.

I could create cash or checks payment thru Business One.

I'm running B1 2005 SP01 PL12

This is DI API Code.

oRecordSet = oRecordSet = oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset)

SqlStr = "Select * FROM SMST3_RCPT WHERE T3_SynchFlag = 0 "

rs = ADOcon.Execute(SqlStr)

While Not rs.EOF

vDoc = oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oIncomingPayments)

vDoc.CardCode = rs.Fields.Item("T3_CardCode").Value

'vDoc.CardName = rs.Fields.Item("T3_CardName").Value

vDoc.CounterReference = Convert.ToString(rs.Fields.Item("T3_DocRef").Value)

vDoc.DocDate = Now

vDoc.DocCurrency = "VUV"

Select Case rs.Fields.Item("T3_PayType").Value

Case 1 '-- Cash

vDoc.CashSum = rs.Fields.Item("T3_CashAmt").Value

Case 2 '-- Cheque

vDoc.Checks.DueDate = Now

vDoc.Checks.CountryCode = "VU"

vDoc.Checks.CheckNumber = rs.Fields.Item("T3_ChqNum").Value

vDoc.Checks.CheckSum = rs.Fields.Item("T3_ChqAmt").Value

'vDoc.Checks.Trnsfrable = SAPbobsCOM.BoYesNoEnum.tNO

Case 3 '-- Credit

ValidDate = "01/" & rs.Fields.Item("T3_ExpiryDate").Value

ValidDate = ValidDate.AddMonths(1)

ValidDate = ValidDate.AddDays(-1)

vDoc.CreditCards.CreditCardNumber = Replace(rs.Fields.Item("T3_CardNum").Value, " ", "")

vDoc.CreditCards.CreditCard = 1

vDoc.CreditCards.CardValidUntil = ValidDate

vDoc.CreditCards.CreditSum = rs.Fields.Item("T3_CreditAmt").Value

vDoc.CreditCards.VoucherNum = "11"

End Select

vDoc.UserFields.Fields.Item("U_LocalCd").Value = Convert.ToString(rs.Fields.Item("T3_LocalCd").Value)

lRetCode = vDoc.Add()

If lRetCode = 0 Then

Else

oCompany.GetLastError(lRetCode, sErrMsg)

End If

vDoc = Nothing

rs.MoveNext()

End While

I hope someone can help me.

Thanks

Message was edited by:

Joanne Lee