You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Tally集成报错:无法将'SVCurrentCompany'设置为'ECAPWEB'求助

问题描述

使用.NET代码向Tally导入数据时,收到报错:

"\r\n Could not set 'SVCurrentCompany' to 'ECAPWEB'\r\n\r\n"

此前集成功能正常运行,已检查代码及公司名称均无异常,想咨询该报错的触发场景。

相关代码
String xmlstc = "";
xmlstc = "<ENVELOPE>\r\n";
xmlstc = xmlstc + "<HEADER>\r\n";
xmlstc = xmlstc + "<TALLYREQUEST>Import Data</TALLYREQUEST>\r\n";
xmlstc = xmlstc + "</HEADER>\r\n";
xmlstc = xmlstc + "<BODY>\r\n";
xmlstc = xmlstc + "<IMPORTDATA>\r\n";
xmlstc = xmlstc + "<REQUESTDESC>\r\n";
xmlstc = xmlstc + "<REPORTNAME>All Masters</REPORTNAME>\r\n";
xmlstc = xmlstc + "<STATICVARIABLES>\r\n";
xmlstc = xmlstc + "<SVCURRENTCOMPANY>" + DIMP + " </SVCURRENTCOMPANY>\r\n";
xmlstc = xmlstc + "</ STATICVARIABLES >\r\n";
xmlstc = xmlstc + "</REQUESTDESC>\r\n";
xmlstc = xmlstc + "<REQUESTDATA>\r\n";
xmlstc = xmlstc + "<TALLYMESSAGE xmlns:UDF=" + "\"" + "TallyUDF" +"\">\r\n";

xmlstc = xmlstc + "<LEDGER NAME=" + "\"" + name + "\" Action =" + "\"" + "Create" + "\">\r\n";
xmlstc = xmlstc + "<NAME>" + name + "</NAME>\r\n";
xmlstc = xmlstc + "<PARENT>" + "Sundry Debtors" + "</PARENT>\r\n";
xmlstc = xmlstc + "<OPENINGBALANCE>" + balance + "</OPENINGBALANCE>\r\n";
xmlstc = xmlstc + "<ADDRESS.LIST TYPE=\"String\">\r\n";
foreach (var item in str)
{
    xmlstc = xmlstc + "<ADDRESS>" + item + "</ADDRESS>\r\n";
}
xmlstc = xmlstc + "</ADDRESS.LIST>\r\n";
xmlstc = xmlstc + "<LEDSTATENAME>" + state + "</LEDSTATENAME>\r\n";
xmlstc = xmlstc + "<PINCODE>" + pincode + "</PINCODE>\r\n";
xmlstc = xmlstc + "<PARTYGSTIN>" + gst + "</PARTYGSTIN>\r\n";

xmlstc = xmlstc + "<GSTREGISTRATIONTYPE>Regular</GSTREGISTRATIONTYPE>\r\n";
xmlstc = xmlstc + "<ISBILLWISEON>Yes</ISBILLWISEON>\r\n";
xmlstc = xmlstc + "</LEDGER>\r\n";

xmlstc = xmlstc + "</TALLYMESSAGE>\r\n";
xmlstc = xmlstc + "</REQUESTDATA>\r\n";
xmlstc = xmlstc + "</IMPORTDATA>\r\n";
xmlstc = xmlstc + "</BODY>";
xmlstc = xmlstc + "</ENVELOPE>";
String xml = xmlstc;
String lLedgerResponse = SendReqst(xml);

string myXml = lLedgerResponse;
XmlDocument doc = new XmlDocument();
doc.LoadXml(myXml);
报错触发场景分析
  • XML格式细节错误:代码中</ STATICVARIABLES >标签存在多余空格,SVCURRENTCOMPANY标签内也有 trailing 空格,可能导致Tally解析XML时无法正确识别静态变量配置。
  • 公司名称匹配问题:即使肉眼看名称正确,也可能存在大小写不一致、不可见字符(如全角/半角空格)的情况,导致传递的ECAPWEB与Tally中实际公司名称不匹配。
  • Tally端公司状态异常:目标公司ECAPWEB可能被重命名、删除,或处于锁定状态(比如被其他用户占用、Tally未正确加载该公司数据)。
  • 权限或连接配置变更:Tally的远程访问设置被修改,或当前连接账号失去了访问ECAPWEB公司的权限,导致无法切换目标公司。
  • Tally版本兼容性问题:Tally进行版本更新后,接口的XML结构要求、参数规则发生变化,原代码的格式不再适配新版本。

内容的提问来源于stack exchange,提问作者Chintan Chheda

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.30 01:07:49