0

I try to write a sowftware so the production can easily confirm the material items. Now when I want to get a production order by a key, it can't find a PO. If I do the same thing with business partner, it works. We use the PPS One addon for the SAP B1, so is there the problem? Is it not possible to access the data from this addon or what have I to change?

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!"); }

There is also a weird thing, in the SAP GUI the po are displayed as work orders, but the coresponding table in the db is @PPSONE_PRDORDERS. But it works neither if I change from SAPbobsCOM.ProductionOrders to SAPbobsCOM.WorkOrders.

Sandra Rossi
  • 11,934
  • 5
  • 22
  • 48
White Wolf
  • 27
  • 6
  • Does the addon create a standard Production Order? – Teta Sep 22 '16 at 19:27
  • @Teta I don't think so, because the addon has its own tables in the database (beginning with @PPSONE_). And the Production Orders an in this table. I hope there is a way to do what I want... – White Wolf Sep 23 '16 at 06:44

2 Answers2

0

If I understood, it doesn't matter what the addon does if at least it creates a record in the PO table, if you want to find the records of PO's you have to query the OWOR table, the field to use in the GeyByKey method of PO is the OWOR.DocEntry.

If this is a UserTable with no Object ou can use the object UserTable

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

If it is a UserTable with Object you have to look for 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)
Teta
  • 129
  • 9
0

There is a SDK from PPS One you can use. Refere to: C:\Program Files\SAP\SAP Business One\AddOns\PPSOne\PPSOne\X64Client\PPSOne_PPSOneSDK.dll. I don't test it.

user5122172
  • 11
  • 1
  • 5