cancel
Showing results for 
Search instead for 
Did you mean: 

Update quantity on a pick list with allocated bins (SAP B1 SDK)

Former Member
0 Kudos

I want to update the picked quantity on a pick list with the SAP B1 SDK.

If there are no bins or sn/batches allocated the updating is working. However, when there are bins allocated I can't seem to update the quantity. We are not using SN/batches on the bins. It is possible to update the quantity on those lines in SAP itself (it won't ask for SN/batches or anything).

I tried a few things such as setting a BaseLineNumber on the bin, but without success. I'm getting the following two errors:

  • 1470000341 - Fully allocate item "11205" to bin locations in warehouse "01-S" (-5002)
  • Internal error (-5002) occurred (-5002)

This is my current code:

public void AddPickedQuantity(int pickListAbsEntry, int lineNumber, int quantity, int binAbsEntry)
{
    try
    {
        PickLists picklist = sap.Company.GetBusinessObject(BoObjectTypes.oPickLists);


        if (picklist.GetByKey(pickListAbsEntry))
        {
            var line = picklist.Lines;
            for (int i = 0; i < line.Count; i++)
            {
                line.SetCurrentLine(i);
                if (line.LineNumber == lineNumber)
                {
                    line.PickedQuantity += quantity;


                    // If there is a bin allocated for this line, add the quantity.
                    if (binAbsEntry > 0)
                    {
                        line.BinAllocations.BinAbsEntry = binAbsEntry;
                        line.BinAllocations.Quantity = quantity;
                    }


                    int returnValue = picklist.Update();


                    if (returnValue != 0)
                    { 
                        sap.Company.GetLastError(out int code, out string message);
                        throw new Exception($"{message} ({code})");
                    }
                    
                    return;
                }
            }
            throw new Exception("Unable to find pick list line.");
        }
    }
    catch(Exception ex)
    {
        throw ex;
    }
}

The code is working when there are no bins allocated. So I am only having trouble to correctly update the quantities when there are bins allocated. It did work a first time though, which I find odd.

Any suggestions, and/or ideas? Thanks in advance!

Accepted Solutions (0)

Answers (1)

Answers (1)

ANKIT_CHAUHAN
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi Lars,

Have you been able to check this?

Pick List in SAP Business One SDK

Hope it helps!

Kind regards,

ANKIT CHAUHAN

SAP SME Support