Hi,
I want to export all JournalEntries, with their JournalEntries_Lines, using SaveXML, and them import, loading the XML file, using the Company GetBusinessObjectFromXML function.
To export just one, I use
Dim oJE As SAPbobsCOM.JournalEntries
oJE = oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oJournalEntries)
If oJE.GetByKey(23) Then
oCA.SaveXML("c:MyJE23.xml")
End If
but, how to export all? I tried with a recordset but it saves a XML file that after doesn´t work with the GetBusinessObjectFromXML function.
What is the XML format to import several JournalEntries with their JournalEntries_Lines, using GetBusinessObjectFromXML, or the JournalEntries.Browser.ReadXml method? Or, if there is another way to do that?
Could someone help me?
Thanks a lot,
Ribeiro Santos
Hi,
There's no option to export more than one object at a time; you will have to handle it by yourself:
1) Export each object separately
<?xml version="1.0" encoding="UTF-16"?>
<BOM>
<BO>
.... here are the data of a single Business Object...
</BO>
</BOM>
2) Add them to one XML that is structured like this:
<?xml version="1.0" encoding="UTF-16"?>
<BOM>
<BO>
.... here comes the first Business Object...
</BO>
<BO>
.... here comes the second Business Object...
</BO>
</BOM>
3) For import you can use both: GetBusinessObjectFromXML or GetBusinessObject + afterwards use .Browser.ReadXML.
In both cases you should use exception handling (in case there are errors in the XML) + you will have to call "Add" and determine whether or not it succeeded.
Please note that there has been a post ("DI: Import XML") regarding the XmlExportType property of the Company object that is also featured in the developer area...
HTH,
Frank
Add a comment