Hi,
There is a scenario we want to export vendor master using XML port for all the company.
For this i have written the codeunit and used the CHANGECOMPANY function to export the data for all the company.
Code which i have written is :
recCompany.FIND('-');
REPEAT
CLEAR(recFile);
CLEAR(recSetup);
CLEAR(recVendor);
recSetup.CHANGECOMPANY(recCompany.Name);
recSetup.GET;
recFile.CREATE(recSetup."File Location"+'\'+recCompany.Name+'_Vendor'+ '.xml');
recFile.CREATEOUTSTREAM(FileOutsream);
CLEAR(recVendor);
recVendor.CHANGECOMPANY(recCompany.Name);
IF recVendor.FINDSET THEN
XMLPORT.EXPORT(50007,FileOutsream,recVendor);
recFile.CLOSE;
UNTIL recCompany.NEXT=0;
When i check the output XML file, data in all the XML file is same for all the company from which i run this codeunit. can anybody suggest why this is happening?
Thanks!
0
Comments
I suggest you to create a function (i.e. setCompany) in your XMLPort and call it to pass the company name, then perform the CHANGECOMPANY directly in the OnPreXMLPort trigger..
It working, as suggested i have made the function in the XML port and pass the company name from the codeunit.