cancel
Showing results for 
Search instead for 
Did you mean: 

DI Stock Transfer tries to create serial items

Former Member
0 Kudos

We have a customized inventory interface for our warehouses that lives outside of the B1 world and it's critical that we be able to import those transfers into B1.

The issue with the stock transfer is that it tries to create a serialized item instead of transferring the one you tell it to. We are on 6.70.185 sp:00 pl:05.

In this specific case we are trying to transfer an item from warehouse 1025 to warehouse 1122. The itemcode is 111455 and its sysserial is 557. We verify that this data is accurate right before adding it to the stocktransfer object. The error message we get on the StockTransfer add is "Found error:-10,Item 111455 with system serial 1574 is not in stock". The highest sysserial for item 111455 in our system is 1573 so it looks like DI is trying to create the serialized item instead of transferring it.

Here's the code:

***************

Public Sub Import_Xfer()

Dim ADSConnection As Connection

Dim ADSLookup As String

Dim ADSRecordset As ADODB.Recordset

Dim ADSCMD As ADODB.Command

Dim RS As ADODB.Recordset

Dim FromWHS As String

Dim ToWHS As String

Dim ItemCode As String

Dim Serial As String

Dim FirstItem As Boolean

Dim StockTransfer As SAPbobsCOM.StockTransfer

Dim stocktransferLines As SAPbobsCOM.StockTransfer_Lines

Dim RecSet As SAPbobsCOM.Recordset

Dim RecSet2 As SAPbobsCOM.Recordset

Dim NewDocNum As Integer

Dim SysSerial As Long

Dim SerialNumber As SAPbobsCOM.SerialNumbers

Dim Addresult As Integer

Dim nErr As Long

Dim errMsg As String

Set ADSConnection = New ADODB.Connection

ADSConnection.CursorLocation = adUseClient

ADSConnection.Open ADSConnStr

Set ADSCMD = New ADODB.Command

ADSCMD.ActiveConnection = ADSConnection

ADSCMD.CommandType = adCmdStoredProc

ADSCMD.CommandText = "econnect..zp_SBO_XFER_Import"

ADSCMD.CommandTimeout = 0

ADSCMD.Parameters.Refresh

Set RS = New ADODB.Recordset

Set RS = ADSCMD.Execute

FirstItem = True

If RS.RecordCount > 0 Then

Call RS.MoveFirst

Set StockTransfer = Company.GetBusinessObject(oStockTransfer)

StockTransfer.Series = 21

StockTransfer.CardCode = "ECHO"

StockTransfer.CardName = "Equip"

Set stocktransferLines = StockTransfer.Lines

Do While RS.EOF = False

FromWHS = RS.Fields(0).Value

ToWHS = RS.Fields(1).Value

ItemCode = RS.Fields(2).Value

Serial = RS.Fields(3).Value

If FirstItem = True Then

StockTransfer.FromWarehouse = FromWHS

Else

StockTransfer.Lines.Add

End If

stocktransferLines.SetCurrentLine (StockTransfer.Lines.Count - 1)

stocktransferLines.ItemCode = ItemCode

stocktransferLines.WarehouseCode = ToWHS

stocktransferLines.Quantity = 1

StockTransfer.Update

Set SerialNumber = stocktransferLines.SerialNumbers

SerialNumber.BaseLineNumber = (StockTransfer.Lines.Count - 1)

SerialNumber.SetCurrentLine (SerialNumber.Count - 1)

Set RecSet2 = Company.GetBusinessObject(BoRecordset)

RecSet2.DoQuery ("select top 1 sysserial from OSRI where intrserial = '" & Serial & "'")

If RecSet2.RecordCount > 0 Then

SysSerial = RecSet2.Fields("sysserial").Value

End If

SerialNumber.InternalSerialNumber = Serial

SerialNumber.SystemSerialNumber = SysSerial

MsgBox (NewDocNum & ": " & FromWHS & ", " & ToWHS & ", " & ItemCode & ", " & Serial & ", " & SysSerial)

FirstItem = False

RS.MoveNext

Loop

If FirstItem = False Then

Addresult = StockTransfer.Add

If (Addresult <> 0) Then

Call Company.GetLastError(nErr, errMsg)

If (0 <> nErr) Then

MsgBox ("Found error:" + Str(nErr) + "," + errMsg)

End If

Else

End If

End If

End If

ADSConnection.Close

Set ADSConnection = Nothing

End Sub

************

Any assistance or examples of stock transfers through the DI will be much appreciated. We are up the creek on this one.

Thanks,

Matt

Accepted Solutions (0)

Answers (1)

Answers (1)

former_member185703
Active Contributor
0 Kudos

Hi Matt,

Did you get your problem solved in the meantime?

Did you report it on SAP Service Marketplace?

Unfortunately I could not double-check the problem you described, yet...

Regards,

Frank

Former Member
0 Kudos

We have reported this to support and it has been identified as a bug. We are just waiting on a code fix at this point. There is at least one other partner this is impacting so hopefully we'll hear something soon.

Thanks,

Matt

Former Member
0 Kudos

Hi Matt,

We have similar problems where inventory returned to the warehouse via the SDK creates duplicate serial numbers (ie new system number with same serial number). Would love to hear that this is going to be fixed.

Regards,

Corbin