无法将付款上传到SAP

2020-09-15 05:41发布

点击此处---> 群内免费提供SAP练习系统(在群公告中)加入QQ群:457200227(SAP S4 HANA技术交流) 群内免费提供SAP练习系统(在群公告中)早上好 ...

         点击此处--->   EasySAP.com群内免费提供SAP练习系统(在群公告中)

加入QQ群:457200227(SAP S4 HANA技术交流) 群内免费提供SAP练习系统(在群公告中)


早上好

我正在通过XML文件上载SAP中处于"打开"状态的发票的付款,但是当界面读取xml文件时,它说发票被冻结或关闭,但不是, 在打开状态。
此接口可在许多客户端上运行,并且以前从未发生过,因此我几乎可以肯定它可以是SAP配置。

客户没有阻止付款的标志。


有什么建议吗?

杂乱无章。

6条回答
悻福寶寶
2020-09-15 06:12

您好,Nagarajan。

我做到了,而且效果很好。


这是代码。

使用ConectoresBO.Conectores;
使用SAPbobsCOM;
使用系统;
使用System.Data.SqlClient;

命名空间SAPBOConector.Documentos
{
公共类oIncomingPayments
{
私有字符串CashAcct;
私有字符串CheckAcct;

public oIncomingPayments(付款入账,SAPbobsCOM.Company sapCompany,ConectoresBO.Conectores.Company公司,int密钥,int索引)
{
SQLAdapter sqlAdapter = company.Conector.SQLAdapter;
int num = -1;
字符串Sentencia ="从[" + sapCompany.CompanyDB +"] .dbo中选择COUNT('A')个。 OPDF WHERE U_BKV_UID ='" + entryPayments.UserFields.Fields.Item((object)" U_BKV_UID")。Value +"'";
SqlDataReader sqlDataReader1 = sqlAdapter.ejecutarConsulta(Sentencia);
如果(sqlDataReader1。 ())
num = sqlDataReader1.GetInt32(0);
sqlAdapter.cerrarConexion();
if(num == 0)
{
Payments businessObject =(Payments)sapCompany.GetBusinessObject (BoObjectTypes.oPaymentsDrafts);
businessObject.DocObjectCode = BoPaymentsObjectType.bopot_IncomingPayments;
businessObject.CardCode = entryPayments.CardCode;
字符串str1 = entryPayments.UserFields.Fields.Item((object)" U_BKV_USUARIO")。Value.ToString();
SqlDataReader sqlDataReader2 = sqlAdapter.ejecutarConsulta("从[" + sapCompany.CompanyDB +"] .dbo.OUDG B,[" + sapCompany.CompanyDB +"] .dbo.OUSR A中选择B.CashAcct,B.CheckAcct,其中A.USER_CODE ='" + str1 +"'AND A.DfltsGroup = B.Code");
如果(sqlDataReader2.Read())
{
this.CashAcct = sqlDataReader2.GetString(0);
此。 CheckAcct = sqlDataReader2.GetString(1);
}
else
this.CashAcct = entryPayments.CashAccount;
sqlAdapter.cerrarConexion();
businessObject.CashSum = entryPayments.CashSum;
businessObject.Remarks = entryPayments.Remarks;
//businessObject.CashAccount = this.CashAcct;
businessObject.CashAccount = entryPayments.CashAccount; ///Cuenta en efectivo
如果(incomingPayments.TransferSum> 0.0)
{
businessObject.TransferSum = entryPayments.TransferSum;
businessObject.TransferAccount = entryPayments.TransferAccount; ///Cuenta Transferencia
businessObject.TransferDate = entryPayments.TransferDate;
businessObject.TransferReference = entryPayments.TransferReference;
}
if(incomingPayments.Checks!= null)
{
for(int LineNum = 0; LineNum {
businessObject.Checks.SetCurrentLine(LineNum);
entryPayments.Checks.SetCurrentLine(LineNum);
if(incomingPayments.Checks.CheckSum!= 0.0)
{
businessObject.Checks.CheckSum = entryPayments.Checks.CheckSum;
businessObject.Checks.CountryCode = entryPayments.Checks.CountryCode;
businessObject。 Checks.Trnsfrable = BoYesNoEnum.tNO;
businessObject.Checks.CheckAccount = entryPayments.Checks.CheckAccount; ///兑现支票
businessObject.Checks.ManualCheck = BoYesNoEnum.tNO;
businessObject.Checks.DueDate = entryPayments.Checks.DueDate;
businessObject.Checks.BankCode = entryPayments.Checks.BankCode; < br> businessObject.Checks.CheckNumber = entryPayments.Checks.CheckNumber;
businessObject.Checks.Add();
}
}
}
如果(incomingPayments.CreditCards!= null)< br> {
for(int LineNum = 0; LineNum {
businessObject.CreditCards.SetCurrentLine(LineNum);
entryPayments.CreditCards.SetCurrentLine( LineNum);
如果(incomingPayments.CreditCards.CreditSum!= 0.0)
{
businessObject.CreditCards.CreditCard = entryPayments.CreditCards.CreditCard;
businessObject.CreditCards.CreditAcct = entryPayments.CreditCards.CreditAcct ;
businessObject.CreditCards.CreditSum = entryPayments.CreditCards.CreditSum;
businessObject.CreditCards.CreditCardNumber = entryPayments.CreditCards.Credit CardNumber;
businessObject.CreditCards.CardValidUntil =传入Payments.CreditCards.CardValidUntil;
businessObject.CreditCards.VoucherNum =传入Payments.CreditCards.VoucherNum;
businessObject.CreditCards.CreditAcct = inputPayments.CreditCards。 businessObject.CreditCards.Add();
}
}
}
如果(incomingPayments.Invoices!= null && entryPayments.Invoices.Count> 0)
{
for(int LineNum = 0; LineNum {
businessObject.Invoices.SetCurrentLine(LineNum);
entryPayments.Invoices.SetCurrentLine(LineNum);
如果(incomingPayments.Invoices.SumApplied> 0.0)
{< br> businessObject.Invoices.InvoiceType = entryPayments.Invoices.InvoiceType;
businessObject.Invoices.DocEntry =传入Payments.Invoices.DocEntry;
businessObject.Invoices.SumApplied = entryPayments.Invoices.SumApplied; InsingApplied;
.TotalDiscount = entryPayments.Invoices.TotalDiscount;
尝试
{
businessObject.Invoices.UserFields.Fields.Item((object)" U_BKV_USUARIO")。Value = entryPayments.Invoices.UserFields.Fields.Item( (对象)" U_BKV_USUARIO")。Value;
}
捕获(异常ex)
{
}
businessObject.Invoices.Add();
}
} < br> businessObject.UserFields.Fields.Item((object)" U_BKV_UID")。Value = entryPayments.UserFields.Fields.Item((object)" U_BKV_UID")。Value;
尝试
{
< br>}
catch(异常例外)
{
}
try
{
businessOb ject.UserFields.Fields.Item((object)" U_BKV_USUARIO")。Value = entryPayments.UserFields.Fields.Item((object)" U_BKV_USUARIO")。Value;
}
catch(异常前)
{
}
businessObject.Add();
字符串str2;
如果((uint)sapCompany.GetLastErrorCode()> 0U)
{
sapCompany.GetLastErrorCode();
str2 ="错误:" + sapCompany.GetLastErrorDescription()。ToString();
}
else
str2 ="完成";
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 +"'," +(对象)索引+",'" + str2.Replace("'","")+"','" + businessObject.UserFields.Fields.Item((对象)" U_BKV_UID")。 值+"')");
sqlAdapter.cerrarConexion();
}
else
{
sqlAdapter.ejecutarSentencia(" UPD ATE" + sapCompany.CompanyDB +" _CONS.dbo.MUTEX SET Result ='错误,您是否已保存文档。',Date = GETDATE()在[Key] =" +(object)key);
sqlAdapter.cerrarConexion ();
}
}
}
}
}

一周热门 更多>