Skip to Content
avatar image
Former Member

Inventory Counting with Serial Number

Hi everyone.

I'm using B1 9.1 PL13.

I'm trying to create a Inventory Counting document with Serial number by DIAPI.

The problem is. There is an item with no quantity available in B1. But I'm try to set quantity 1 in Inventory Counting document, with a Serial Number that already exist in B1.

But all the time i get an error saying "The item xxxx with serial number xxxx does not exist in waherehouse."

Anyone can help me?

Add comment
10|10000 characters needed characters exceeded

  • Former Member

    Here is the part of the code where i set the serial number.

    //Get the SysSerial from the SAP

    dsSerialNumber = dataAccess.B1Data.getOleDbData("select top 1 isnull(SysSerial, 0) SysSerial from OSRI where SuppSerial = '" + produto.Serie + "' and itemcode = '" + produto.ProdutoCodigo + "' order by InDate desc");

    //Add new Line Serial

    newInventarioLineSerie = newInventarioLine.InventoryCountingSerialNumbers.Add();

    //Set the exist SysSerial

    newInventarioLineSerie.SystemSerialNumber = dsSerialNumber.Tables[0].Rows.Count > 0 ? Convert.ToInt32(dsSerialNumber.Tables[0].Rows[0]["SysSerial"].ToString()) : 0;

    //Set ManufacturerSerialNumber

    newInventarioLineSerie.ManufacturerSerialNumber = produto.Serie;

    //Set Internal Serial Number

    newInventarioLineSerie.InternalSerialNumber = produto.Serie;

    //Set the quantity

    newInventarioLineSerie.Quantity = Convert.ToDouble(produto.Quantidade, new System.Globalization.CultureInfo("en-US"));

  • Hi Eduardo,

    Use the primary tag as SAP Business One SDK to get more answers, and if possible, share your code.

    Kind Regards,

    Diego Lother

  • Former Member DIEGO LOTHER

    Thanks Diego for the tip...

  • Get RSS Feed

2 Answers

  • Jul 17, 2017 at 07:10 PM

    Hi Eduardo,

    I try to reproduce your scenario, and got the same situation. My sample code:

                    CompanyService oCS = (SAPbobsCOM.CompanyService)oCompany.GetCompanyService();
                    InventoryCountingsService oICS = oCS.GetBusinessService(SAPbobsCOM.ServiceTypes.InventoryCountingsService);
                    InventoryCounting oIC = oICS.GetDataInterface(SAPbobsCOM.InventoryCountingsServiceDataInterfaces.icsInventoryCounting);
                    DateTime dt = DateTime.Now;
                    oIC.CountDate = DateTime.Now;
                    oIC.BranchID = 1;
                    InventoryCountingLines oICLS = oIC.InventoryCountingLines;
                    InventoryCountingLine oICL = oICLS.Add();
                    oICL.ItemCode = "AA1CP6410-A0106";
                    oICL.CountedQuantity = 1;
                    oICL.WarehouseCode = "001.01";
                    oICL.Counted = SAPbobsCOM.BoYesNoEnum.tYES;
                    InventoryCountingSerialNumber oICLserial = oICL.InventoryCountingSerialNumbers.Add();
                    //oICLserial.InternalSerialNumber = "Teste 1234";
                    oICLserial.SystemSerialNumber = 1;
                    //oICLserial.ManufacturerSerialNumber = "Teste 1234";
                    oICLserial.Quantity = 1;
    
    
                    SAPbobsCOM.InventoryCountingParams oICP = oICS.Add(oIC);
    

    I saw that if I need to do the same action on SAP Business One Client I need to click on Create button on select serial numbers screen.

    Maybe something missed on this functionality on SDK.

    If you get no answers, I suggest you to try open a ticket on SAP support to discover if this is a bug or system design.

    Hope it helps.

    Kind Regards,

    Diego Lother

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member

      Thanks Diego. I'll try to figure out what's going on. I've tried many ways to do it works but without success until now.

  • Jul 06 at 03:36 AM

    hi all,

    anyone have solution for this case ?

    i am using SAP B1 9.3 PL4 HANA, and still can not update serial number that already exists.

    please help.

    Add comment
    10|10000 characters needed characters exceeded