是否可以使用SAP B1中的DI SDK访问PPSONE数据?

时间:2016-09-22 15:09:46

标签: c# sap sapb1

我尝试编写一个sowftware,以便生产可以轻松确认材料项目。 现在,当我想通过密钥获取生产订单时,它找不到采购订单。 如果我与业务合作伙伴做同样的事情,它就有效。 我们为SAP B1使用PPS One插件,那么有问题吗?是否无法访问此插件中的数据或我需要更改哪些内容?

SAPbobsCOM.BusinessPartners vBP = connection.company.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oBusinessPartners);
SAPbobsCOM.ProductionOrders vPO = connection.company.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oProductionOrders);

if(vBP.GetByKey("L22437"))
{
  WriteLogLine("Name: " + vBP.CardName); // Works, i get the Name!
}
else { WriteLogLine("No matching customer record was found!");  }

if (vPO.GetByKey(anyKey)) // tried a lot of keys, no one worked
{
  WriteLogLine(vPO.GetAsXML());
}
else { WriteLogLine("No matching production order record was found!"); }

还有一个奇怪的事情,在SAP GUI中po显示为工单,但db中的相应表是@PPSONE_PRDORDERS。但是,如果我从SAPbobsCOM.ProductionOrders更改为SAPbobsCOM.WorkOrders,它既不起作用。

1 个答案:

答案 0 :(得分:0)

如果我理解了,如果至少它在PO表中创建了一个记录,那么插件的作用并不重要,如果你想查找PO的记录,你必须查询OWOR表,要使用的字段PO的GeyByKey方法是OWOR.DocEntry。

如果这是没有对象的UserTable,则可以使用对象UserTable

UserTable oUst = (UserTable)oCompany.UserTables.Item(YOURTABLE);
if oUst.GetByKey("1") ....

如果是带对象的UserTable,则必须查找GenericServices

Dim oGeneralService As SAPbobsCOM.GeneralService
Dim oGeneralData As SAPbobsCOM.GeneralData
Dim oGeneralParams As SAPbobsCOM.GeneralDataParams

Dim sCmp As SAPbobsCOM.CompanyService
sCmp = oCompany.GetCompanyService

'Get a handle to the SM_MOR UDO
oGeneralService = sCmp.GetGeneralService("SM_MOR")

'Get UDO record
oGeneralParams =    oGeneralService.GetDataInterface(SAPbobsCOM.GeneralServiceDataInterfaces.gsGeneralDataParams)
oGeneralParams.SetProperty("DocEntry", "2")
oGeneralData = oGeneralService.GetByParams(oGeneralParams)