on 2018 Jul 31 3:26 PM
Good Morning
I am uploading a payment of an invoice that is in Open status in SAP through an XML file,
but when the interface reads the xml file it says that the invoice is blocked or closed and it is not, it is in open state.
This interface runs on many clients and it has not happened to me before so I am almost sure it can be an SAP configuration.
the customer does not have the blocked flag for payments.
Any recommendation?
reagards.
Help others by sharing your knowledge.
AnswerRequest clarification before answering.
Try to add invoice mauual and check what field your are missing or wron in your tool
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Try to create manually one of the payment in SAP, then you know issue.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Nagarajan.
I did and it works fine.
This is the code.
using ConectoresBO.Conectores;
using SAPbobsCOM;
using System;
using System.Data.SqlClient;
namespace SAPBOConector.Documentos
{
public class oIncomingPayments
{
private string CashAcct;
private string CheckAcct;
public oIncomingPayments(Payments incomingPayments, SAPbobsCOM.Company sapCompany, ConectoresBO.Conectores.Company company, int key, int index)
{
SQLAdapter sqlAdapter = company.Conector.SQLAdapter;
int num = -1;
string Sentencia = "SELECT COUNT('A') FROM [" + sapCompany.CompanyDB + "].dbo.OPDF WHERE U_BKV_UID='" + incomingPayments.UserFields.Fields.Item((object)"U_BKV_UID").Value + "'";
SqlDataReader sqlDataReader1 = sqlAdapter.ejecutarConsulta(Sentencia);
if (sqlDataReader1.Read())
num = sqlDataReader1.GetInt32(0);
sqlAdapter.cerrarConexion();
if (num == 0)
{
Payments businessObject = (Payments)sapCompany.GetBusinessObject(BoObjectTypes.oPaymentsDrafts);
businessObject.DocObjectCode = BoPaymentsObjectType.bopot_IncomingPayments;
businessObject.CardCode = incomingPayments.CardCode;
string str1 = incomingPayments.UserFields.Fields.Item((object)"U_BKV_USUARIO").Value.ToString();
SqlDataReader sqlDataReader2 = sqlAdapter.ejecutarConsulta("select B.CashAcct , B.CheckAcct from [" + sapCompany.CompanyDB + "].dbo.OUDG B, [" + sapCompany.CompanyDB + "].dbo.OUSR A where A.USER_CODE='" + str1 + "'AND A.DfltsGroup=B.Code ");
if (sqlDataReader2.Read())
{
this.CashAcct = sqlDataReader2.GetString(0);
this.CheckAcct = sqlDataReader2.GetString(1);
}
else
this.CashAcct = incomingPayments.CashAccount;
sqlAdapter.cerrarConexion();
businessObject.CashSum = incomingPayments.CashSum;
businessObject.Remarks = incomingPayments.Remarks;
//businessObject.CashAccount = this.CashAcct;
businessObject.CashAccount = incomingPayments.CashAccount; /// Cuenta en efectivo
if (incomingPayments.TransferSum > 0.0)
{
businessObject.TransferSum = incomingPayments.TransferSum;
businessObject.TransferAccount = incomingPayments.TransferAccount; /// Cuenta Transferencia
businessObject.TransferDate = incomingPayments.TransferDate;
businessObject.TransferReference = incomingPayments.TransferReference;
}
if (incomingPayments.Checks != null)
{
for (int LineNum = 0; LineNum < incomingPayments.Checks.Count; ++LineNum)
{
businessObject.Checks.SetCurrentLine(LineNum);
incomingPayments.Checks.SetCurrentLine(LineNum);
if (incomingPayments.Checks.CheckSum != 0.0)
{
businessObject.Checks.CheckSum = incomingPayments.Checks.CheckSum;
businessObject.Checks.CountryCode = incomingPayments.Checks.CountryCode;
businessObject.Checks.Trnsfrable = BoYesNoEnum.tNO;
businessObject.Checks.CheckAccount = incomingPayments.Checks.CheckAccount; /// cuenta en cheque
businessObject.Checks.ManualCheck = BoYesNoEnum.tNO;
businessObject.Checks.DueDate = incomingPayments.Checks.DueDate;
businessObject.Checks.BankCode = incomingPayments.Checks.BankCode;
businessObject.Checks.CheckNumber = incomingPayments.Checks.CheckNumber;
businessObject.Checks.Add();
}
}
}
if (incomingPayments.CreditCards != null)
{
for (int LineNum = 0; LineNum < incomingPayments.CreditCards.Count; ++LineNum)
{
businessObject.CreditCards.SetCurrentLine(LineNum);
incomingPayments.CreditCards.SetCurrentLine(LineNum);
if (incomingPayments.CreditCards.CreditSum != 0.0)
{
businessObject.CreditCards.CreditCard = incomingPayments.CreditCards.CreditCard;
businessObject.CreditCards.CreditAcct = incomingPayments.CreditCards.CreditAcct;
businessObject.CreditCards.CreditSum = incomingPayments.CreditCards.CreditSum;
businessObject.CreditCards.CreditCardNumber = incomingPayments.CreditCards.CreditCardNumber;
businessObject.CreditCards.CardValidUntil = incomingPayments.CreditCards.CardValidUntil;
businessObject.CreditCards.VoucherNum = incomingPayments.CreditCards.VoucherNum;
businessObject.CreditCards.CreditAcct = incomingPayments.CreditCards.CreditAcct;
businessObject.CreditCards.Add();
}
}
}
if (incomingPayments.Invoices != null && incomingPayments.Invoices.Count > 0)
{
for (int LineNum = 0; LineNum < incomingPayments.Invoices.Count; ++LineNum)
{
businessObject.Invoices.SetCurrentLine(LineNum);
incomingPayments.Invoices.SetCurrentLine(LineNum);
if (incomingPayments.Invoices.SumApplied > 0.0)
{
businessObject.Invoices.InvoiceType = incomingPayments.Invoices.InvoiceType;
businessObject.Invoices.DocEntry = incomingPayments.Invoices.DocEntry;
businessObject.Invoices.SumApplied = incomingPayments.Invoices.SumApplied;
businessObject.Invoices.TotalDiscount = incomingPayments.Invoices.TotalDiscount;
try
{
businessObject.Invoices.UserFields.Fields.Item((object)"U_BKV_USUARIO").Value = incomingPayments.Invoices.UserFields.Fields.Item((object)"U_BKV_USUARIO").Value;
}
catch (Exception ex)
{
}
businessObject.Invoices.Add();
}
}
businessObject.UserFields.Fields.Item((object)"U_BKV_UID").Value = incomingPayments.UserFields.Fields.Item((object)"U_BKV_UID").Value;
try
{
}
catch (Exception ex)
{
}
try
{
businessObject.UserFields.Fields.Item((object)"U_BKV_USUARIO").Value = incomingPayments.UserFields.Fields.Item((object)"U_BKV_USUARIO").Value;
}
catch (Exception ex)
{
}
businessObject.Add();
string str2;
if ((uint)sapCompany.GetLastErrorCode() > 0U)
{
sapCompany.GetLastErrorCode();
str2 = "Error :" + sapCompany.GetLastErrorDescription().ToString();
}
else
str2 = "Done";
sqlAdapter.ejecutarSentencia("UPDATE " + sapCompany.CompanyDB + "_CONS.dbo.MUTEX SET Result='" + str2.Replace("'", "") + "', Date=GETDATE() WHERE [Key]=" + (object)key);
sqlAdapter.cerrarConexion();
sqlAdapter.ejecutarSentencia("INSERT INTO " + sapCompany.CompanyDB + "_CONS.dbo.LOG([Key],[index],resultado,u_bkv_uid) VALUES ('" + (object)key + "'," + (object)index + ",'" + str2.Replace("'", "") + "','" + businessObject.UserFields.Fields.Item((object)"U_BKV_UID").Value + "')");
sqlAdapter.cerrarConexion();
}
else
{
sqlAdapter.ejecutarSentencia("UPDATE " + sapCompany.CompanyDB + "_CONS.dbo.MUTEX SET Result='Error, ya existe el documento.', Date=GETDATE() WHERE [Key]=" + (object)key);
sqlAdapter.cerrarConexion();
}
}
}
}
}
Hi,
Did you receive any error message? Check posting date of payment valid.
Regards,
Nagarajan
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
60 | |
9 | |
8 | |
7 | |
6 | |
4 | |
3 | |
3 | |
2 | |
2 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.