on 08-08-2006 10:02 AM
Hello !
I'm trying to write a routine that will duplicate a record in the item master (OITM) table. The new item will have a different ItemCode, and some other different details, but needs to have the rest of it's information copied from the original (ie. price etc.) - is there a standard method I can use to copy it ? I've thought about using a SQL statement, but I know that manipulating the tables in this way isn't recommended (and i'm not convinced It'll let me). The only other way I can think of doing it is by setting an DI Item object, creating a record using the standard method, and setting each field individually from an array I've populated by querying the original record... something like this :
oitem.ItemCode = "CT-G400-005"
oitem.ItemName = arrayWithOriginalDetails(1)
oitem.ItemType = arrayWithOriginalDetails(2)
oitem.BarCode = arrayWithOriginalDetails(3)
etc....
oitem.add
- but there're a lot of fields to individually specify- I'm hoping there might be an easier way...
(does this make sense?)
Hi Welch,
You could use saveAsXML and then change the xml (programmatically) and insert the new item.
There are several threads about this issue on the forum.
Regards
Ad
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
great.
I use saveXML to output the record, then GetBusinessObjectFromXML to create a new object from the saved file, and changed the relevant details using
oIT = oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oItems)
oCompany.XmlExportType = SAPbobsCOM.BoXmlExportTypes.xet_ExportImportMode
oIT = oCompany.GetBusinessObjectFromXML(sPath, 0)
oIT.ItemCode = blah, blah, blah.
not sure how it decided on unique fields like DocRef, or what it used for ItemCode before I'd specified it, but it worked okay, so i'll not worry about it.
thanks!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
101 | |
12 | |
11 | |
6 | |
6 | |
4 | |
3 | |
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.