cancel
Showing results for 
Search instead for 
Did you mean: 

SAP B1 9.0 Inventory Transfer (Stock Transfer) - DI API

Former Member
0 Kudos

I am writing an application that uses the DI API to create an inventory transfer between warehouse AND bin locations (new to version 9.0) in SAP B1 9.0 PL01.  I am struggling with adding the bin locations to the inventory transfer object.  I receive the following error:

-5002-1470000465 - You cannot allocate bin locations in document row 1

Can someone please show me where I am going wrong with this?  Here is my code:

                SAPbobsCOM.StockTransfer transfer = (SAPbobsCOM.StockTransfer)sapCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oStockTransfer);

                transfer.DocDate = DateTime.Now;
                transfer.FromWarehouse = fromWhs;
                transfer.ToWarehouse = toWhs;

                transfer.Lines.SetCurrentLine(0);
                transfer.Lines.ItemCode = itemCode;
                transfer.Lines.FromWarehouseCode = fromWhs;
                transfer.Lines.WarehouseCode = toWhs;
                transfer.Lines.Quantity = quantity;
                if (batchCtl)
                {
                    transfer.Lines.BatchNumbers.SetCurrentLine(0);
                    transfer.Lines.BatchNumbers.BatchNumber = userLotNumber;
                    transfer.Lines.BatchNumbers.Quantity = quantity;
                    transfer.Lines.BatchNumbers.Add();
                }
                else
                {
                    if (serialCtl)
                    {
                        transfer.Lines.SerialNumbers.SetCurrentLine(0);
                        transfer.Lines.SerialNumbers.ManufacturerSerialNumber = userLotNumber;
                        transfer.Lines.SerialNumbers.Quantity = quantity;
                        transfer.Lines.SerialNumbers.Add();
                    }
                }

                transfer.Lines.BinAllocations.SetCurrentLine(0);
                transfer.Lines.BinAllocations.BinActionType = SAPbobsCOM.BinActionTypeEnum.batFromWarehouse;
                transfer.Lines.BinAllocations.BinAbsEntry = fromLocation;
                transfer.Lines.BinAllocations.Quantity = quantity;
                transfer.Lines.BinAllocations.Add();

                transfer.Lines.BinAllocations.SetCurrentLine(1);
                transfer.Lines.BinAllocations.BinActionType = SAPbobsCOM.BinActionTypeEnum.batToWarehouse;
                transfer.Lines.BinAllocations.BinAbsEntry = toLocation;
                transfer.Lines.BinAllocations.Quantity = quantity;
                transfer.Lines.BinAllocations.Add();

                int returnCode = transfer.Add();

Thank you in advance

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Hello,

I was solve this issue.

Change:

  transfer.Lines.BinAllocations.BinActionType = SAPbobsCOM.BinActionTypeEnum.batFromWarehouse;

With

  transfer.Lines.BinAllocations.BinActionType = 2

Regards,

Leonardo San Martín.

former_member183750
Active Contributor
0 Kudos

Hello

Please note the description from the Overview for this SCN Space:

Official SAP Help Portal Community. Find comments on SAP product documentation (such as SAP Application Help, also known as SAP Library), and read best practices shared by the community.

Based do the above, I believe you posted your query into the incorrect SCN Space. Please use the Forum Finder for the New SCN document to find your product and post into that SCN Space.

With best regards,

- Ludek