Showing results for 
Search instead for 
Did you mean: 

Copying an Item Master Record

Former Member
0 Kudos

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)



- but there're a lot of fields to individually specify- I'm hoping there might be an easier way...

(does this make sense?)

Accepted Solutions (1)

Accepted Solutions (1)

Active Contributor
0 Kudos

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.



Former Member
0 Kudos


We've been trying to modify an XML programatically to later do a GetBusinessObjectFromXML into BP´s, but keep getting errors of XML malformation, have you any ideas or sample code about this matter?



Answers (1)

Answers (1)

Former Member
0 Kudos


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.