Skip to Content
0

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

May 12, 2017 at 03:26 PM

187

avatar image

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

10 |10000 characters needed characters left characters exceeded

Do you have one line and one bin?

0
* Please Login or Register to Answer, Follow or Comment.

3 Answers

ANKIT CHAUHAN
May 12, 2017 at 03:32 PM
0

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

Show 1 Share
10 |10000 characters needed characters left characters exceeded

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

0
Danilo Kasparian May 12, 2017 at 03:41 PM
0

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

Show 3 Share
10 |10000 characters needed characters left characters exceeded

Hello Danilo,

thank you for your reply.

Lines.BinLocations.Add() is used for the second line and on, I have double checked it, so this does not seem to be the problem.

Kind regards,

Dimitris Theotokatos

0

Does your item is managed by batch or serial?

0

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.

0
Danilo Kasparian May 12, 2017 at 04:33 PM
0

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

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


Show 1 Share
10 |10000 characters needed characters left characters exceeded

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

0