on 05-04-2017 2:09 PM - last edited on 02-03-2024 9:55 PM by postmig_api_4
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:
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!
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
107 | |
12 | |
11 | |
6 | |
6 | |
4 | |
4 | |
3 | |
3 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.