
Using Inventory Counting in SAP Business One SDK:
SAPbobsCOM.CompanyService oCS = (SAPbobsCOM.CompanyService)oCompany.GetCompanyService();
SAPbobsCOM.InventoryCountingsService oICS = oCS.GetBusinessService(SAPbobsCOM.ServiceTypes.InventoryCountingsService);
SAPbobsCOM.InventoryCounting oIC = oICS.GetDataInterface(SAPbobsCOM.InventoryCountingsServiceDataInterfaces.icsInventoryCounting);
DateTime dt = DateTime.Now;
oIC.CountDate = DateTime.Now;
SAPbobsCOM.InventoryCountingLines oICLS = oIC.InventoryCountingLines;
SAPbobsCOM.InventoryCountingLine oICL = oICLS.Add();
oICL.ItemCode = "A00001";
oICL.CountedQuantity = 4;
oICL.WarehouseCode = "01";
oICL.Counted = SAPbobsCOM.BoYesNoEnum.tYES;
SAPbobsCOM.InventoryCountingParams oICP = oICS.Add(oIC);
SAPbobsCOM.CompanyService oCS = oCompany.GetCompanyService();
SAPbobsCOM.InventoryCountingsService oICS = (SAPbobsCOM.InventoryCountingsService)oCS.GetBusinessService(SAPbobsCOM.ServiceTypes.InventoryCountingsService);
SAPbobsCOM.InventoryCountingParams oICP = (SAPbobsCOM.InventoryCountingParams)oICS.GetDataInterface(SAPbobsCOM.InventoryCountingsServiceDataInterfaces.icsInventoryCountingParams);
oICP.DocumentEntry = 1;
SAPbobsCOM.InventoryCounting oIC = oICS.Get(oICP) as SAPbobsCOM.InventoryCounting;
SAPbobsCOM.InventoryCountingLine line = oIC.InventoryCountingLines.Item(0);
line.CountedQuantity = 2;
oICS.Update(oIC);
SAPbobsCOM.CompanyService oCS = SBOCompany.GetCompanyService();
SAPbobsCOM.InventoryCountingsService oICS = (SAPbobsCOM.InventoryCountingsService)oCS.GetBusinessService(SAPbobsCOM.ServiceTypes.InventoryCountingsService);
SAPbobsCOM.InventoryCountingParams oICP = (SAPbobsCOM.InventoryCountingParams)oICS.GetDataInterface(SAPbobsCOM.InventoryCountingsServiceDataInterfaces.icsInventoryCountingParams);
SAPbobsCOM.InventoryCountingLine oICl;
oICP.DocumentEntry = 1;
SAPbobsCOM.InventoryCounting oIC = oICS.Get(oICP) as SAPbobsCOM.InventoryCounting;
int i = 0;
while ((i < oIC.InventoryCountingLines.Count))
{
oICl = oIC.InventoryCountingLines.Item(i);
if ((oICl.CountedQuantity == 0))
{
oIC.InventoryCountingLines.Remove(i);
}
i = (i + 1);
}
oICS.Update(oIC);
SAPbobsCOM.CompanyService oCS = SBOCompany.GetCompanyService();
SAPbobsCOM.InventoryCountingsService oICS = (SAPbobsCOM.InventoryCountingsService)oCS.GetBusinessService(SAPbobsCOM.ServiceTypes.InventoryCountingsService);
SAPbobsCOM.InventoryCountingParams oICP = (SAPbobsCOM.InventoryCountingParams)oICS.GetDataInterface(SAPbobsCOM.InventoryCountingsServiceDataInterfaces.icsInventoryCountingParams);
SAPbobsCOM.InventoryCountingLine oICl;
oICP.DocumentEntry = 1;
SAPbobsCOM.InventoryCounting oIC = oICS.Get(oICP) as SAPbobsCOM.InventoryCounting;
oICS.Close(oICP);
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
31 | |
5 | |
4 | |
3 | |
3 | |
3 | |
2 | |
2 | |
2 | |
2 |