我正在尝试使用适用于.NET的SAP Business One(B1或BO)数据接口API(DI API)获取所有公司帐户的列表。
帐户表示为ChartOfAccounts
SDK的类型
我无法弄清楚是否有办法做这样的事情(这是我如何得到项目清单):
var oItem = (Items) Company.GetBusinessObject(BoObjectTypes.oItems);
var oSBObob = (SBObob)Company.GetBusinessObject(BoObjectTypes.BoBridge);
var oRecordSet = oSBObob.GetItemList();
但对GetItemList()
类型的帐户似乎没有与SBObob
类似的方法。
有人知道如何获取公司帐户清单吗?
答案 0 :(得分:2)
我使用Recordset
方法通过查询OACT
数据库表直接获取帐户密钥列表(AcctCode
数据库字段),然后使用ChartOfAccounts
&#39来实现此目的; s GetByKey()
方法填写其他ChartOfAccounts
字段,如下所示:
var sapAccount = (ChartOfAccounts)Company.GetBusinessObject(BoObjectTypes.oChartOfAccounts);
var oRecordSet = (Recordset)company.GetBusinessObject(BoObjectTypes.BoRecordset);
oRecordSet.DoQuery("SELECT AcctCode FROM OACT");
while (!oRecordSet.EoF)
{
var key = oRecordSet.Fields.Item(0).Value.ToString();
sapAccount.GetByKey(key)
// Now sapAccount is filled with current account data - do something with its fields
oRecordSet.MoveNext();
}