Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics NAV (Archived)

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

Posted on by 6,578

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

  • ManishS Profile Picture
    ManishS 6,578 on at
    RE: Could not find a part of the path when generating report in pdf format via C/AL.

    No I am not getting error for folder.

  • manjusree Profile Picture
    manjusree 175 on at
    RE: Could not find a part of the path when generating report in pdf format via C/AL.

    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
    ManishS 6,578 on at
    RE: Could not find a part of the path when generating report in pdf format via C/AL.

    I am checking this on application server it self ?

  • Suggested answer
    Rajasekhar@MS Profile Picture
    Rajasekhar@MS 5,567 on at
    RE: Could not find a part of the path when generating report in pdf format via C/AL.

    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
    ManishS 6,578 on at
    RE: Could not find a part of the path when generating report in pdf format via C/AL.

    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.

  • manjusree Profile Picture
    manjusree 175 on at
    RE: Could not find a part of the path when generating report in pdf format via C/AL.

    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

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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,280 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,214 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans