Hi,
I am trying to add Outgoing payment based on an invoice through the DI API but I got an error"[OACT] , 'No matching records found (ODBC -2028)". I was just using the SAP Business One 2005 Demo data to set all the value. The C# code is below:
public static void AddOutgoingPayment(SAPbobsCOM.Company company){
SAPbobsCOM.Payments vPay = (SAPbobsCOM.Payments) company.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oVendorPayments);
vPay.CardCode = "V23000";
vPay.CardName = "Anthony Smith";
vPay.Address = "1901 Maynesboro Drive, Suite 200, Camden PA 19065, USA";
vPay.JournalRemarks = "Outgoing - V23000";
vPay.DocDate = DateTime.Today;
vPay.DocType = SAPbobsCOM.BoRcptTypes.rSupplier;
vPay.CashSum = 100000;
vPay.DocCurrency = "USD";
vPay.CheckAccount = "_SYS00000000002";
vPay.DocObjectCode = SAPbobsCOM.BoPaymentsObjectType.bopot_OutgoingPayments;
//Purchase Invoice
vPay.Invoices.DocEntry = 21;
vPay.Invoices.DocLine = 0;
vPay.Invoices.InvoiceType = SAPbobsCOM.BoRcptInvTypes.it_PurchaseInvoice;
vPay.Invoices.SumApplied = 100000;
//Check
vPay.Checks.AccounttNum = "100-3443-7867";
vPay.Checks.BankCode = "BOA";
vPay.Checks.Branch = "54";
vPay.Checks.CheckNumber = 389;
vPay.Checks.CheckSum = 100000;
vPay.Checks.Details = "Check";
vPay.Checks.DueDate = new DateTime(2006,3,1,0,0,0,0);
int returnVal = vPay.Add();
int errCode;
string errMsg;
if(returnVal != 0){
company.GetLastError(out errCode, out errMsg);
string msg = string.Format("Error Code: {0}; Error Message: ", errCode, errMsg);
Console.WriteLine(msg);
return;
}
Console.WriteLine("Successfully Add outgoing payment!");
}
}
I am confused why I get this error and would appreciate if anyone can help me out.
Thank you in advance,
Sunny