Your code is a mess. Here I fixed it for you.
CustBill.RESET;
CustBill.SETFILTER(CustBill."Customer No.",'%1',Customers."No.");
IF CustBill.FIND('-') THEN
BEGIN //you missed this one
CustLocal.SETRANGE("No.", Customers."No.");
IF CustLocal.FINDSET THEN //use findset already its year 2016
BEGIN
REPEAT
CustNumber:= CustLocal."No.";
tofile := '.pdf';
Filename := 'C:\reports\'+CustNumber+tofile;
REPORT.SAVEASPDF(50050, Filename, CustLocal); //propper parameters
UNTIL CustBill.NEXT=0;
end;
END;
Pay attention to this line
REPORT.SAVEASPDF(50050, Filename, CustLocal);
Depending on dataitems in report you may have to use CustLocal
or CustBill
variable as last parameter. It will be used as filterset for your report.
And one more thing. As MSDN says:
The FileName parameter specifies a location on the computer running
Microsoft Dynamics NAV Server. If you call this function from the
RoleTailored client, such as from an action on a page, then use the
DOWNLOAD Function (File) to download the .pdf file from the computer
running Microsoft Dynamics NAV Server to the computer running the
RoleTailored client.
So don't look for your file on local machine where client is running.
Any other problems urged you to post the question twice?