Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Export/import formatted search to XML

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

Former Member
replied

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

0 View this answer in context
Not what you were looking for? View more on this topic or Ask a question