Skip to Content
avatar image
Former Member

SerialAndBatchNumbersBaseLine in Stock Transfer DI API

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

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

  • Best Answer
    Jun 07, 2017 at 06:12 PM

    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
    Add comment
    10|10000 characters needed characters exceeded

  • Jun 08, 2017 at 08:42 AM

    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
    	
    	
    	
    
    Add comment
    10|10000 characters needed characters exceeded

    • Former Member

      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