web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Microsoft Dynamics NAV (Archived)

Could not find a part of the path when generating report in pdf format via C/AL.

(0) ShareShare
ReportReport
Posted on by 86

I am getting below error when generating a report via C/AL,

Microsoft Dynamics NAV
---------------------------

Could not find a part of the path 'D:\EmailPDF\PSI_1617_0222.pdf'.
---------------------------
OK
---------------------------

This is the code which I have written,
CLEAR(InvoiceReport);
InvoiceReport.USEREQUESTPAGE(FALSE);
InvoiceReport.SetInvoiceNo(InvNo); ------> Have set filter for invoice no., by sending the parameter.

FOR i := 1 TO STRLEN(InvNo) DO BEGIN
    IF (InvNo[i] = '/') OR
       (InvNo[i] = '\') OR
       (InvNo[i] = '-') OR
       (InvNo[i] = '.') THEN
       InvNo[i] := '_';
END;

FileName := 'D:\EmailPDF\'+ InvNo +'.pdf';
InvoiceReport.SAVEASPDF(FileName);

*This post is locked for comments

  • manjusree Profile Picture
    175 on at

    hi,

    Please check if EmailPDF folder exists in your D drive and you have enough permissions in that folder. Hope client and server are on same machine

  • ManishS Profile Picture
    86 on at

    I have this code written which takes care of the folder,

    SearchDirectory := 'D:\EmailPDF';

    IF NOT SystemDirectory.Exists(SearchDirectory) THEN      

     SystemIODirectoryInfo := SystemDirectory.CreateDirectory(SearchDirectory);

    Yes the user has full access to the folder.

    Nope this is a three tier installation.

  • Suggested answer
    Rajasekhar@MS Profile Picture
    5,569 on at

    Hi Manish

    As it is a Three tier ,first generate Temp file on server and save pdf to serverfile and then download to client like below.

    ServerTempFile := FileMgmt.servertempfilename('pdf');

    Report.saveaspdf(ServerTempFile);

    ileMgmt.DownloadToFile(ServerFileName,ClientFileName);

  • ManishS Profile Picture
    86 on at

    I am checking this on application server it self ?

  • manjusree Profile Picture
    175 on at

    May I know which automation you are using for creating directory?. Are you getting error if EmailPDF folder is already present in D drive?

  • ManishS Profile Picture
    86 on at

    No I am not getting error for folder.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Women in Power Builds Momentum

Expanding mentorship, skilling, and AI innovation

Congratulations to the August Top 10 Community Leaders

These are the community rock stars!

Leaderboard > 🔒一 Microsoft Dynamics NAV (Archived)

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans