Skip to Content
avatar image
Former Member

The quantity allocated to bin locations must be positive - Inventory Transfer

Hello everybody,

I try to perform an Inventory Transfer, bound to a Inventory Transfer Request, but I get an error at Bin Location data when I try to add the inventory transfer.

1470000368 - The quantity allocated to bin locations must be positive

If I comment out the code referring to Bin Location the operation is completed with no errors

oTransfer.Lines.BinAllocations.Add()
oTransfer.Lines.BinAllocations.BinActionType = SAPbobsCOM.BinActionTypeEnum.batFromWarehouse 
oTransfer.Lines.BinAllocations.BinAbsEntry = item.BinFrom 
oTransfer.Lines.BinAllocations.Quantity = item.Quantity
oTransfer.Lines.BinAllocations.AllowNegativeQuantity = SAPbobsCOM.BoYesNoEnum.tYES
oTransfer.Lines.BinAllocations.SerialAndBatchNumbersBaseLine = item.LineNo

My issue is that I need to declare the Bin Location Allocation data manually and not to let defaults values added in System.

Any suggestions are appreciated.

Kind regards,

Dimitris Theotokatos

Add comment
10|10000 characters needed characters exceeded

  • Do you have one line and one bin?

  • Get RSS Feed

3 Answers

  • May 12, 2017 at 03:32 PM

    Hi,

    Below code is working for me:

    StockTransfer doc = oCompany.GetBusinessObject(BoObjectTypes.oStockTransfer);
    doc.DocDate = DateTime.Now;
    doc.DueDate = DateTime.Now;
    doc.CardCode = "C20000";
    doc.Lines.ItemCode = "A00001";
    doc.Lines.BaseEntry = 2;
    doc.Lines.BaseLine = 0;
    doc.Lines.BaseType = InvBaseDocTypeEnum.InventoryTransferRequest;
    doc.Lines.WarehouseCode = "05";
    
    
    doc.Lines.BinAllocations.BinActionType = BinActionTypeEnum.batFromWarehouse;
    doc.Lines.BinAllocations.BinAbsEntry = 2;
    doc.Lines.BinAllocations.Quantity = 1;
    
    doc.Lines.BinAllocations.Add();
    doc.Lines.BinAllocations.BinActionType = BinActionTypeEnum.batToWarehouse;
    doc.Lines.BinAllocations.BinAbsEntry = 3;
    doc.Lines.BinAllocations.Quantity = 1;
    
    int n = doc.Add();
    
    if (n != 0)
    {
        oCompany.GetLastError(out lErrCode, out sErrMsg);
        MessageBox.Show(lErrCode.ToString() + sErrMsg);
    }
    else
    {
        string addedCode = string.Empty;
        oCompany.GetNewObjectCode(out addedCode);
        MessageBox.Show("Return:" + n.ToString() + "; documents " + addedCode + " is added sucessfully ");
    

    Kind regards,

    ANKIT CHAUHAN

    SAP SME Support

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member

      Dear Ankit,

      thank you for your reply.

      If I comment out

      oTransfer.Lines.BinAllocations.AllowNegativeQuantity = SAPbobsCOM.BoYesNoEnum.tYES
      oTransfer.Lines.BinAllocations.SerialAndBatchNumbersBaseLine = item.LineNo
      

      from Bin Allocation as you suggested I get this error

      1470000838 - Invalid "SerialAndBatchNumbersBaseLine"; specify a valid "SerialAndBatchNumbersBaseLine"

      Kind regards,

      Dimitris Theotokatos

  • May 12, 2017 at 03:41 PM

    if everything is correct, you are using BinAction To and From warehouse, double check this Lines.BinLocations.Add(), you don`t need to use .Add for the first BinLocations

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member

      Yes, and I use

      oTransfer.Lines.BatchNumbers.BatchNumber = item.LOT
      oTransfer.Lines.BatchNumbers.Quantity = item.Quantity
      

      The above lines does not seem to cause any problem because if I comment out all bin allocation code but these lines the stock transfer is added successfully.

  • May 12, 2017 at 04:33 PM

    Did you check the setting to allow negative stock in document settings?

    12-05-2017-12-31-46-pm.png

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member

      Used the same configuration as you suggested but still got the same error referring to Bin quantity allocation

      1470000368 - The quantity allocated to bin locations must be positive

      Kind regards,

      Dimitris Theotokatos