Skip to Content
0

SerialAndBatchNumbersBaseLine in Stock Transfer DI API

Jun 07, 2017 at 12:28 PM

448

avatar image

Hello everybody,

I use a function to add a new Inventory/Stock Transfer bound to an existing Inventory Transfer Request.

oTransfer.Lines.ItemCode = item.ItemCode
oTransfer.Lines.Quantity = item.Quantity
oTransfer.Lines.MeasureUnit = item.MeasurementUnit
oTransfer.Lines.FromWarehouseCode = item.wFrom
oTransfer.Lines.WarehouseCode = item.wTo
oTransfer.Lines.BaseLine = item.LineNo
oTransfer.Lines.BaseType = SAPbobsCOM.InvBaseDocTypeEnum.InventoryTransferRequest
oTransfer.Lines.BaseEntry = item.Entry

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
'line variable is controlled outside the function
oTransfer.Lines.BinAllocations.SerialAndBatchNumbersBaseLine = line

oTransfer.Lines.BinAllocations.Add()
oTransfer.Lines.BinAllocations.BinActionType = SAPbobsCOM.BinActionTypeEnum.batToWarehouse
oTransfer.Lines.BinAllocations.BinAbsEntry = item.BinTo
oTransfer.Lines.BinAllocations.Quantity = item.Quantity
oTransfer.Lines.BinAllocations.AllowNegativeQuantity = SAPbobsCOM.BoYesNoEnum.tYES
'line variable is controlled outside the function
oTransfer.Lines.BinAllocations.SerialAndBatchNumbersBaseLine = line

oTransfer.Lines.BatchNumbers.BatchNumber = item.LOT
oTransfer.Lines.BatchNumbers.Quantity = item.Quantity

oTransfer.Lines.Add()

above function works correct if the lines of the Inventory Transfer is 1.

For 2 ore more lines I get an error with error code -10 and error's description is

1470000838 - Invalid "SerialAndBatchNumbersBaseLine"; specify a valid "SerialAndBatchNumbersBaseLine"

line variable is incremented by one each time the function is called, so for the first line SerialAndBatchNumbersBaseLine value is set to 0, second line is 1, and so on.

Can anyone suggest a solution to fix this issue I face?

EDIT

if I replace

oTransfer.Lines.BinAllocations.SerialAndBatchNumbersBaseLine = line

with

oTransfer.Lines.BinAllocations.SerialAndBatchNumbersBaseLine = 0

then I get this error

1250000015 - No release warehouse has been defined

Kind regards,

Dimitris Theotokatos

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

2 Answers

Best Answer
Danilo Kasparian Jun 07, 2017 at 06:12 PM
0

I believe the problem is with your batches, the base line is for batch/serial not for Lines itself, so if you have one batch for each line your SerialAndBatchNumbersBaseLine will be always 0 probably

oTransfer.Lines.BatchNumbers.BatchNumber = item.LOT
oTransfer.Lines.BatchNumbers.Quantity = item.Quantity
Show 2 Share
10 |10000 characters needed characters left characters exceeded

Hello Danilo,

thanks for your reply.

Seems like you are correct about changing SerialAndBatchNumbersBaseLine to 0.

The issue now is that I get an error code -5002 with description

1250000015 - No release warehouse has been defined

even though I have declared

oTransfer.Lines.WarehouseCode = item.wTo

Could you please explain what this means?

Kind regards,

Dimitris Theotokatos

0

solved this error by adding

oTransfer.FromWarehouse = wFrom

and

oTransfer.ToWarehouse = wTo

in Transfer header

0
Edy Simon Jun 08, 2017 at 08:42 AM
1

Hi Dimitris,

The structure should be something like below

oTransfer.Lines.ItemCode = "ABC"		--(Item Line 0)
	oTransfer.Lines.BatchNumbers.BatchNumer = "Batch1"	--(Item Line 0 - Batch Line 0)
	oTransfer.Lines.BatchNumbers.Add
	oTransfer.Lines.BatchNumbers.BatchNumer = "Batch2"	--(Item Line 0 - Batch Line 1)
	oTransfer.Lines.BatchNumbers.Add
	oTransfer.Lines.BatchNumbers.BatchNumer = "Batch3"	--(Item Line 0 - Batch Line 2)
	
	
	oTransfer.Lines.BinAllocations.SerialAndBatchNumbersBaseLine = 0		-- This will point that this From bin is for Batch 1
	oTransfer.Lines.BinAllocations.BinActionType = SAPbobsCOM.BinActionTypeEnum.batFromWarehouse
	oTransfer.Lines.BinAllocations.BinAbsEntry = item.BinFrom
	oTransfer.Lines.BinAllocations.Quantity = item.Quantity
	
	oTransfer.Lines.BinAllocations.Add()
	oTransfer.Lines.BinAllocations.SerialAndBatchNumbersBaseLine = 0		--This will point that this To Bin is for Batch 1
	oTransfer.Lines.BinAllocations.BinActionType = SAPbobsCOM.BinActionTypeEnum.batToWarehouse
	oTransfer.Lines.BinAllocations.BinAbsEntry = item.BinTo
	oTransfer.Lines.BinAllocations.Quantity = item.Quantity
	
	
	oTransfer.Lines.BinAllocations.Add()
	oTransfer.Lines.BinAllocations.SerialAndBatchNumbersBaseLine = 1		--This will point that this From Bin is for Batch 2
	oTransfer.Lines.BinAllocations.BinActionType = SAPbobsCOM.BinActionTypeEnum.batFromWarehouse
	oTransfer.Lines.BinAllocations.BinAbsEntry = item.BinFrom
	oTransfer.Lines.BinAllocations.Quantity = item.Quantity
	
	oTransfer.Lines.BinAllocations.Add()
	oTransfer.Lines.BinAllocations.SerialAndBatchNumbersBaseLine = 1		--This will point that this To Bin is for Batch 2
	oTransfer.Lines.BinAllocations.BinActionType = SAPbobsCOM.BinActionTypeEnum.batToWarehouse
	oTransfer.Lines.BinAllocations.BinAbsEntry = item.BinTo
	oTransfer.Lines.BinAllocations.Quantity = item.Quantity
	
	
	
Show 1 Share
10 |10000 characters needed characters left characters exceeded

Hello Edy,

thanks for your reply.

As Danilo also recommended above SerialAndBatchNumbersBaseLine value should be equal to current Batch line number, just like you correctly mention.

Kind regards,

Dimitris Theotokatos

0