Skip to Content
author's profile photo Former Member
Former Member

DI Stock Transfer tries to create serial items

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

Add a comment
10|10000 characters needed characters exceeded

Related questions

1 Answer

  • Posted on Jan 12, 2005 at 11:28 AM

    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

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      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

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.