cancel
Showing results for 
Search instead for 
Did you mean: 

How to update existing warehouse info for an item?

Former Member
0 Kudos

Hi,

I want to update existing Item warehouse info object using DIAPIS in C#.

But I do not see GetBYKey call on this object and there is no column like LineNum in OITW either.

If there is LineNum,I could have passed the LineNum to the SetCurrentLine method.

It would be expensive to loop through all the existing warehouse codes for that item to select the warehouse to be updated.

So how should I point to the existing warehouse code for a given item?

Can somebody please let me know the recommended way of updating existing warehouses on OITW?

Regards,

Sudha

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Following was done with VB 6, last few lines illustrate how to access Warehouse Info for Item, use Call AddItem(True) to execute:

Public Sub AddItem(ynAdd As Boolean)

fWriteLog ("START: AddItem ============")

Dim sItemCode As String

Dim iMode, Counter, i As Integer

Dim As Integer

sItemCode = InputBox("Enter an Items' code", "Item Code")

If sItemCode <> "" Or Not IsNull(sItemCode) Then

Set oItems = oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oItems)

With oItems

If .GetByKey(sItemCode) Then

iMode = 2

If ynAdd = False Then iMode = 3

Else

iMode = 1

If ynAdd = False Then iMode = 0

End If

Select Case iMode

Case 1: 'Add

fWriteLog ("..Item '" & sItemCode & "' does not exist")

.ItemCode = sItemCode

.ItemName = sItemCode & " [NEW]"

lRetCode = .Add

Call IsError("..Adding Item", lRetCode)

Case 2: 'Update

fWriteLog ("..Item '" & sItemCode & "' found by Code")

.ItemName = sItemCode & " - " & DateTime.Now

lRetCode = .Update

Call IsError("..Updating Item", lRetCode)

Case 3: 'Remove

fWriteLog ("..Item '" & sItemCode & "' found by Code")

lRetCode = .Remove

Call IsError("..Removing Item", lRetCode)

Case Else 'Not found

fWriteLog ("..Item '" & sItemCode & "' does not exist")

fWriteLog ("..No more tasks to do")

End Select

End With

End If

'ACCES WAREHOUSE INFO ON ITEM ASSUMING YOU HAVE

'4 WAREHOUSES. USE COUNT OR NOT "" FOR ALL

With oItems

For i = 1 To 4

.WhsInfo.SetCurrentLine i

MsgBox (.WhsInfo.WarehouseCode)

Next i

End With

Set oItems = Nothing

fWriteLog ("END AddItem ============ TJE - " & vbCrLf)

End Sub

Answers (1)

Answers (1)

Former Member
0 Kudos

The DI API exposes the ItemWarehouseInfo object for accessing OITW - this is a child object of the Items object. You first need to use the GetByKey call on an Items object to find the item record itself, you can then access the OITW details through the items "WhsInfo" property.

John.