0

我尝试编写一个软件,以便生产可以轻松确认材料项目。现在当我想通过key获取生产订单时,找不到PO。如果我对商业伙伴做同样的事情,它会起作用。我们为 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,它也不起作用。

4

2 回答 2

0

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

如果这是一个没有对象的 UserTable,你可以使用对象 UserTable

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

如果它是一个带有 Object 的 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)
于 2016-09-23T14:24:22.423 回答
0

您可以使用 PPS One 的 SDK。参考:C:\Program Files\SAP\SAP Business One\AddOns\PPSOne\PPSOne\X64Client\PPSOne_PPSOneSDK.dll。我不测试它。

于 2021-12-08T06:42:29.947 回答