Search code examples
navisiondynamics-nav-2013dynamics-nav-2016

How to generate pdf report automatically in Dynamics NAV


I have designed a report and i would like to save each report in pdf into a specifi folder. How do i achieve this using a codeunit or report?

Number:=50050;
 CustBill.RESET;
IF CustBill.FIND('-') THEN
tofile := DELCHR(CustBill."Customer No." +    FORMAT(CustBill.Date),'=','/\:.,') + '.pdf';
Filename := 'D:\Bills\'+'tofile';
REPORT.SAVEASPDF(Number, Filename,Runrpt)

Solution

  • This statement IF CustBill.FIND('-') THEN if used without begin and end only related to the single next line of code. In your case this one tofile := DELCHR(CustBill."Customer No." + FORMAT(CustBill.Date),'=','/\:.,') + '.pdf'; This will probably cause this line to newer be executed.