是否可以使用 SAP B1 的 DI SDK 访问 PPSONE 数据?
Is it possible to access the PPSONE data with the DI SDK from SAP B1?
我尝试编写一个软件,以便生产可以轻松确认 material 项。
现在,当我想通过密钥获取生产订单时,找不到采购订单。
如果我对商业伙伴做同样的事情,它就会奏效。
我们为 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中对应的table是@PPSONE_PRDORDERS。但是,如果我从 SAPbobsCOM.ProductionOrders 更改为 SAPbobsCOM.WorkOrders.
,它也不起作用
如果我理解的话,插件做什么并不重要,只要它至少在 PO table 中创建一条记录,如果你想找到 PO 的记录,你必须查询 OWOR table,在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)
您可以使用 PPS One 的 SDK。参考:C:\Program Files\SAP\SAP Business One\AddOns\PPSOne\PPSOne\X64Client\PPSOne_PPSOneSDK.dll
。我不测试。
我尝试编写一个软件,以便生产可以轻松确认 material 项。 现在,当我想通过密钥获取生产订单时,找不到采购订单。 如果我对商业伙伴做同样的事情,它就会奏效。 我们为 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中对应的table是@PPSONE_PRDORDERS。但是,如果我从 SAPbobsCOM.ProductionOrders 更改为 SAPbobsCOM.WorkOrders.
,它也不起作用如果我理解的话,插件做什么并不重要,只要它至少在 PO table 中创建一条记录,如果你想找到 PO 的记录,你必须查询 OWOR table,在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)
您可以使用 PPS One 的 SDK。参考:C:\Program Files\SAP\SAP Business One\AddOns\PPSOne\PPSOne\X64Client\PPSOne_PPSOneSDK.dll
。我不测试。