on 03-02-2007 10:32 PM
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
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
94 | |
9 | |
8 | |
5 | |
4 | |
3 | |
3 | |
3 | |
3 | |
2 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.