on 08-13-2014 4:49 PM
Hi Team,
How to assign batch/serial in bin location for inventory transfer (From Bin Location , To Bin Location ). Is it similiar in below
sample code
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(0);
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();
Hi Yin,
Remove both the 'setcurrentline' lines.
Regards
Edy
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Yin,
SetCurrentLine is used for moving the focus to a certain row of the childs.
SetCurrentLine(0) means you are asking the focus to move to first row.
When you are adding rows, it does not make sense for you to keep on updating the first row.
This logic applies to all childs of DI API objects, not only bin.
LineItem, Batch are having the same logic.
Regards
Edy
Hi Edy,
Yea, i understand the set current line . This is how i applied previously for the batch/serial assigning
For intBinRowCount = 0 To intTotalRow - 1
oDocument.Lines.SerialNumbers.SetCurrentLine(intBinRowCount)
oDocument.Lines.SerialNumbers.InternalSerialNumber = dviewSerialNo(intBinRowCount)("SerialNo")
If drDocLines("BinEnable") = "Y" Then
oDocument.Lines.BinAllocations.SetCurrentLine(oDocument.Lines.BinAllocations.Count - 1)
oDocument.Lines.BinAllocations.BinAbsEntry = dviewSerialNo(intBinRowCount)("BinAbsEntry")
oDocument.Lines.BinAllocations.BaseLineNumber = oDocument.Lines.Count - 1
oDocument.Lines.BinAllocations.SerialAndBatchNumbersBaseLine = oDocument.Lines.SerialNumbers.Count - 1
oDocument.Lines.BinAllocations.Quantity = 1
oDocument.Lines.BinAllocations.Add()
End If
oDocument.Lines.SerialNumbers.Add()
Next
Hi Yin,
Although your code is not wrong :
oDocument.Lines.BinAllocations.SetCurrentLine(oDocument.Lines.BinAllocations.Count - 1)
The above code is actually not needed because you are trying to set the line to the last line.
When you are adding a document, initially, the line focus is already at the last line,
and when you execute the Add() method, the line focus will be automatically moved to the last line.
And in your original sample code, you always use
transfer.Lines.BinAllocations.SetCurrentLine(0);
Which is wrong because you are always setting it to the first line.
Regards
Edy
User | Count |
---|---|
108 | |
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.