I am using a console application which runs specified reports/codeunits from Dynamics NAV 2013 version. The process is done by passing parameters down fromt he console application to the published web service. I can run some objects, but this one is causing me a bit of trouble to get going.
-OnPreReport-
rImportExportEngine.GET('Export');
tFileName := rImportExportEngine.GetFileName();
tSeparator := FORMAT('|');
// create file
CLEAR(fOut);
fOut.TEXTMODE := TRUE;
fOut.CREATE(rImportExportEngine."Folder Path" + tFileName);
-OnPostReport-
fOut.CLOSE;
COPY(rImportExportEngine."Folder Path" + tFileName,rImportExportEngine."Archive Folder Path" + tFileName);
The code did contain an excel buffer, but I removed it. Any clue would be great.
0
Answers
Blog - rockwithnav.wordpress.com/
Twitter - https://twitter.com/RockwithNav
Facebook - https://facebook.com/rockwithnav/
rImportExportEngine.GET('Item Export');
tFileName := rImportExportEngine.GetFileName();
END;
It looks like you have changed the code in your report and that's now the code that calls the rImportExportEngine.GetFileName() function. If so then are you setting tFileName to something when GUIALLOWED is false - i.e. when it's running as a Web Service?
EXIT(STRSUBSTNO("File Name",FORMAT(CURRENTDATETIME,0,"Date and Time Format")));
Now try commenting all the code in the OnPreReport and OnPostReport just to double check. If you still get the error then you know it's some other code causing the problem.