If in role tailored, then the codeunit is executed on the NAV server. That means the file location is relative to the server, so the file is stored on the server. And if the C:\APP is not available (not created or no permission by the NAV service) then it will not create the file.
But since I don’t know which version, you’re using then I don’t know if this could be an issue. So please always, remember to mention the version. It allows the other users to give a more precise/correct answer. [:)]
Thanks for your reply, the Version is NAV 2009R2, if i run from RTC (copied code to page) the report is generated and mail is send successfully with the attachment. The issue is when I run the code from codeunit with classic client, the file is not created. But since i can run the scheduler with only classic, i want the report to be generated from codeunit.
John
I seem to remember similar issues with email codeunits and Classic so have you tried using a report and then adding this to the scheduler? Not what you wanted and not the ideal solution but should work.
Neil
And you are aware that when you run the same code using the classic client, then the C:\app\salesVSbudget.pdf is created locally on the C: drive of the classic client?
Did you try to run it with the debugger? At what point does it fail there?
Yes when code is run with classic client, the file should be created on local drive, i am aware of that.
while debugging, the code REPORT.SAVEASPDF(50038, ‘C:\app\salesVSbudget.pdf’, Location) is executed successfully but when i check the C:\APP folder the file is not created.
In the classic client you would have to make some custom code to use a pdf printer driver to save the file to pdf. There are a lot of questions and answers in this forum about how to do that with the classic client already.