on 12-14-2013 3:36 AM
Hi expert!
I have to use SDK to create Inventory transfer (just move Item with Batch code to other Bins ).
My codes :
.
.....
oTransfer.Lines.ItemCode = StrItemCode
oTransfer.Lines.Quantity = nQty
For i As Integer = 0 To dtItemScan.DefaultView.Count - 1
oTransfer.Lines.FromWarehouseCode = FromWhsCode
oTransfer.Lines.WarehouseCode = ToWhsCode
oTransfer.Lines.BatchNumbers.BatchNumber = dtItemScan.DefaultView(i).Item("BatchCode").ToString
oTransfer.Lines.BatchNumbers.Quantity = nQty
oTransfer.Lines.BatchNumbers.Add()
oTransfer.Lines.BinAllocations.BinActionType = SAPbobsCOM.BinActionTypeEnum.batFromWarehouse
oTransfer.Lines.BinAllocations.BinAbsEntry = 2 ' CInt(dtItemScan.DefaultView(i).Item("FromBin").ToString)
oTransfer.Lines.BinAllocations.Quantity = dtItemScan.DefaultView(i).Item("Quantity")
oTransfer.Lines.BinAllocations.SerialAndBatchNumbersBaseLine = i
oTransfer.Lines.BinAllocations.Add()
oTransfer.Lines.BinAllocations.BinActionType = SAPbobsCOM.BinActionTypeEnum.batToWarehouse
oTransfer.Lines.BinAllocations.BinAbsEntry = 4 'CInt(dtItemScan.DefaultView(i).Item("ToBin").ToString)
oTransfer.Lines.BinAllocations.Quantity = nQty
oTransfer.Lines.BinAllocations.SerialAndBatchNumbersBaseLine = i
oTransfer.Lines.BinAllocations.Add()
Next
oTransfer.Lines.Add()
'Add the document
RetVal = oTransfer.Add
Error:
-10 1470000838 - Invalid "敓楲污湁䉤瑡档畎扭牥䉳獡䱥湩e"; specify a valid "敓楲污湁䉤瑡档畎扭牥䉳獡䱥湩e"
I have already added Good Receipt PO successfully . But with above codes use for inventory transfer , I can't not. Help me , please!
Thank you!
Hi,
in your code you are trying to create one stocktransferline with different binlocation ( incl. batch ).
You are adding an empty line at the end : in DI Api the first line is already present and you have to add from the 2nd line ( beginning of loop ).
This C# code adds a stocktransfer with 10 lines :
SAPbobsCOM.StockTransfer oTransfer = SBO_Company.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oStockTransfer);
for (int i = 0; i < 10; i++)
{
int nQty = quantity[0]
if (i > 0)
oTransfer.Lines.Add();
oTransfer.Lines.ItemCode = itemcode[i];
oTransfer.Lines.Quantity = nQty;
oTransfer.Lines.FromWarehouseCode = fromwhs[i];
oTransfer.Lines.WarehouseCode = towhs[i];
oTransfer.Lines.BatchNumbers.BatchNumber = batch[i];
oTransfer.Lines.BatchNumbers.Quantity = nQty;
oTransfer.Lines.BinAllocations.BinActionType = SAPbobsCOM.BinActionTypeEnum.batFromWarehouse;
oTransfer.Lines.BinAllocations.BinAbsEntry = frombin[i];
oTransfer.Lines.BinAllocations.Quantity = nQty;
oTransfer.Lines.BinAllocations.SerialAndBatchNumbersBaseLine = 0;
oTransfer.Lines.BinAllocations.Add();
oTransfer.Lines.BinAllocations.BinActionType = SAPbobsCOM.BinActionTypeEnum.batToWarehouse;
oTransfer.Lines.BinAllocations.BinAbsEntry = tobin[i];
oTransfer.Lines.BinAllocations.Quantity = nQty;
oTransfer.Lines.BinAllocations.SerialAndBatchNumbersBaseLine = 0;
}
if (oTransfer.Add() != 0)
MessageBox.Show("Error : "+SBO_Company.GetLastErrorDescription());
else
MessageBox.Show("Transfer added");
Hope it helps,
Maik
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
103 | |
12 | |
11 | |
6 | |
5 | |
4 | |
3 | |
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.