on 12-18-2008 4:44 PM
Hello,
I want to duplicate an item.
The source item is in two warehouses. The destination item should be not in warehouses (phantom item).
The following code doesn't work. Can you help me please?
Dim Artik as String = "OLDITEM"
Dim OITM As SAPbobsCOM.Items
OITM = oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oItems)
OITM.GetByKey(Artik)
'New Values
OITM.IsPhantom = SAPbobsCOM.BoYesNoEnum.tYES
OITM.SalesItem = SAPbobsCOM.BoYesNoEnum.tNO
OITM.InventoryItem = SAPbobsCOM.BoYesNoEnum.tNO
OITM.PurchaseItem = SAPbobsCOM.BoYesNoEnum.tNO
OITM.DefaultWarehouse = ""
For j As Integer = OITM.WhsInfo.Count To 0 Step -1
OITM.WhsInfo.SetCurrentLine(j)
OITM.WhsInfo.WarehouseCode = ""
Next j
OITM.ItemCode = "NEWITEM"
lRetCode = OITM.Add
How can I delete the WhsInfo-Part.
Can you show me a exemple please?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Marcel,
Because have tried the same, but because you can't delete rows in whsinfo and in this object there is store old itemcode there i suggest use xml for this here is some very old code which i use hope it will helpfull
oCmp.XmlExportType = SAPbobsCOM.BoXmlExportTypes.xet_ExportImportMode
oItem.SaveXML("C:\itemm.xml")
Dim file As String
Dim xd As New Xml.XmlDocument
xd.Load("c:\itemm.xml")
Dim nod As Xml.XmlNode = xd.SelectSingleNode("/BOM/BO/Items/row/ItemCode[text()='" & oItem.ItemCode.ToString & "']")
nod.InnerText = SAP.GetEditText(oForm.Items.Item("NItem").Specific)
xd.Save("c:\itemm.xml")
'Retrieve the object back from the XML file
oItem2 = oCmp.GetBusinessObjectFromXML("C:\itemm.xml", 0)
''oItem2.ItemCode = SAP.GetEditText(oForm.Items.Item("NItem").Specific)
oItem2.ItemName = SAP.GetEditText(oForm.Items.Item("NItemName").Specific)
oItem2.Properties(64) = SAPbobsCOM.BoYesNoEnum.tYES
''oItem2.WhsInfo.WarehouseCode = "01"
Dim lBomItem As Integer
If oItem2.Add() Then
oCmp.GetLastError(lErrCode, sErrMsg)
oApp.MessageBox("Error " & ": " & sErrMsg, 1, "OK")
End If
Thank you.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Marcel,
In your case you want to create new item.
and you passed " " as Warehouse
But in OITM there are only two mandatory fields
ItemCode and Manufacturer.
So if you don't want to pass warehouse then don't write that line in your code.
may be this will help you
Hepil Doshi
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
98 | |
11 | |
11 | |
6 | |
6 | |
4 | |
4 | |
3 | |
3 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.