cancel
Showing results for 
Search instead for 
Did you mean: 

Export/import formatted search to XML

Former Member
0 Kudos

Hello to all, he would need some example of exportation and import of formattedSearch to XML. Thank you very much.

Accepted Solutions (1)

Accepted Solutions (1)

Nussi
Active Contributor
0 Kudos

Hi Andreas,

i made a c# code for you

Export


string FileName = "C:\\TEST.xml";

SAPbobsCOM.FormattedSearches oFS = null;
oFS = ((SAPbobsCOM.FormattedSearches)(oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oFormattedSearches)));

oCompany.XmlExportType = SAPbobsCOM.BoXmlExportTypes.xet_ExportImportMode;

oFS.GetByKey(1); // IndexID from CSHS table
oFS.SaveXML(ref FileName);

Import


string FileName = "C:\\TEST.xml";

oCompany.XmlExportType = SAPbobsCOM.BoXmlExportTypes.xet_ExportImportMode;
oFS = ((SAPbobsCOM.FormattedSearches)(oCompany.GetBusinessObjectFromXML(FileName, 0)));
if (oFS.Add() == 0)
{
     Console.WriteLine("Added");
}
else
{
   Console.WriteLine(globals.oCompany.GetLastErrorDescription());
}

this code worked for me - but remember that formatted searches can only be assigned once to a field

actually i pray that you wanted this and not userqueries

lg David

Answers (1)

Answers (1)

Former Member
0 Kudos

Hello Andres,

If you need an xml for copy userQuery's from one database to another, you can beter use copyexpress...

If you don't need it ignore this message..

Regards,