Hello Experts,
1. I'm using "Form Settings" to set desire order to columns in Documents Forms (Sales Orders, Invoices, etc). When I do this, my columns are rearranged and the user-feel is good.
2. I'm using FormPreferencesService, ColumnsPreferences objects, to get the "Form Settings" I already defined, then I save my XML output. (This was performed in one Company db Backup, let's say version 2)
3. Then, I restore a previous Company db Backup (version 1). Using FormPreferencesService.GetDataInterfaceFromXMLFile and FormPreferencesService.UpdateColumnsPreferences methods I'm trying to apply my XML saved in step 2. Close SAP client to save changes.
When I open my Document Form, some columns are rearranged, but this action is not doing the work as desired, leaving some columns in the middle of others, etc.
Is there something that I'm missing when I work with this object?
Here's the code:
Getting xml output:
Dim compSrv As SAPbobsCOM.CompanyService _ = aEnv.dCompany.GetCompanyService() Dim fpSrv As SAPbobsCOM.FormPreferencesService _ = CType(compSrv.GetBusinessService(SAPbobsCOM.ServiceTypes.FormPreferencesService), SAPbobsCOM.FormPreferencesService) Dim colPrefParams As SAPbobsCOM.ColumnsPreferencesParams _ = CType(fpSrv.GetDataInterface(SAPbobsCOM.FormPreferencesServiceDataInterfaces.fpsdiColumnsPreferencesParams), SAPbobsCOM.ColumnsPreferencesParams) Dim colPref As SAPbobsCOM.ColumnsPreferences colPrefParams.FormID = CStr(pFormTypeEx) colPrefParams.User = user colPref = fpSrv.GetColumnsPreferences(colPrefParams) colPref.ToXMLFile(xmlOutPutFile)
Updating column preferences:
Dim compSrv As SAPbobsCOM.CompanyService _ = aEnv.dCompany.GetCompanyService() Dim fpSrv As SAPbobsCOM.FormPreferencesService _ = CType(compSrv.GetBusinessService(SAPbobsCOM.ServiceTypes.FormPreferencesService), SAPbobsCOM.FormPreferencesService) Dim colPrefParams As SAPbobsCOM.ColumnsPreferencesParams _ = CType(fpSrv.GetDataInterface(SAPbobsCOM.FormPreferencesServiceDataInterfaces.fpsdiColumnsPreferencesParams), SAPbobsCOM.ColumnsPreferencesParams) Dim colPref As SAPbobsCOM.ColumnsPreferences colPrefParams.FormID = CStr(pFormTypeEx) colPrefParams.User = user colPref = CType(fpSrv.GetDataInterfaceFromXMLFile(xmlFile), SAPbobsCOM.ColumnsPreferences) fpSrv.UpdateColumnsPreferences(colPrefParams, colPref)
Thanks for the help.
Best regards.
gab