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

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

Getting Error while trying to save the report a PDF in local drive using save dialog

(0) ShareShare
ReportReport
Posted on by

Hi all,

I am getting the following error while trying to save the report as pdf using save dialog .

Please let me know how to resolve it ?

" Error opening the file ‘C:\Program Files\Microsoft Dynamics AX\.0\client\appl\standard\’.
File Not found. "

Below is My Code :

public void init()
{

this.printJobSettings().setTarget(PrintMedium::File);
this.printJobSettings().preferredFileFormat(PrintFormat::PDF);
this.printJobSettings().fileName(fileName);
super();

}

}

----------------------------------------------------------------------------------------------

public PrintMedium setTarget(PrintMedium _target)
{
PrintMedium ret;

ret = super(PrintMEdium::File);

return ret;
}

----------------------------------------------------------------------------------------------------

public boolean printerSettings(int _showWhat=-1)
{
boolean ret;

ret = super(_showWhat);

return ret;
}

-----------------------------------------------------------------------------------------------------------

public Object dialog(Object _dialog)
{
Dialog d = super(_dialog);
df = d.addFieldValue(typeid(FileNameSave), "Select file to save");
d.filenameLookupFilter(["PDF Files","*.pdf"]);
d.filenameLookupTitle("Select filename and type");
df.value(df.value());
fileName = df.value();
return d;
}

-------------------------------------------------------------------------------------------------------

public class ReportRun extends ObjectRun
{
CompanyInfo companyInfo;
tmp_InventTableModule tModules;
test_PrintDataCustPrcList testPrcList;
// dialog d ;//= new dialog("Select file");
PrintJobSettings printJobSettings;
dialogField df;
FileName fileName;
}

---------------------------------------------------------------------------------------------------------

public void run()
{
this.printJobSettings().setTarget(PrintMedium::File);
this.printJobSettings().fileName(fileName);

this.printJobSettings().format(PrintFormat::PDF);
super();
}

---------------------------------------------------------------------------------------

PLEASE LET ME KNOW WHAT AM I DOING WRONG HERE . I DON'T NO WHY THAT ERROR IS COMING UP AND HOW TO RESOLVE IT ?

PLEASE HELP

*This post is locked for comments

I have the same question (0)
  • André Arnaud de Calavon Profile Picture
    300,721 Super User 2025 Season 2 on at
    RE: Getting Error while trying to save the report a PDF in local drive using save dialog

    Hi,

    Do you also have a method "getFromDialog" implemented? This should read the value entered by the user.

  • Community Member Profile Picture
    on at
    RE: Getting Error while trying to save the report a PDF in local drive using save dialog

    Hi Andre,

    DO I need to create the method.  it's not a override method right?

    But Why am I getting that Error Please let me know ?

  • André Arnaud de Calavon Profile Picture
    300,721 Super User 2025 Season 2 on at
    RE: Getting Error while trying to save the report a PDF in local drive using save dialog

    You do need to retrieve the filename value entered by the user. It seems to be empty now, having AX using a default directory as file name.

    The file name in your error message is:  â€˜C:\Program Files\Microsoft Dynamics AX\.0\client\appl\standard\’ This is a filepath only; no filename is known for AX currently.

    So the code "fileName = df.value();" needs to set on another place. You are now using it on initiation of the dialog.

  • Martin Dráb Profile Picture
    237,693 Most Valuable Professional on at
    RE: Getting Error while trying to save the report a PDF in local drive using save dialog

    Microsoft Mania, you're forgetting about the debugger. If you looked at what value you put into this.printJobSettings().fileName(), you would have immediately seen that it's wrong (if the error message wasn't clear enough) and therefore you have a problem in setting the value of filename.

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
Priya_K Profile Picture

Priya_K 4

#2
Alexey Lekanov Profile Picture

Alexey Lekanov 3

#3
Scott_itD Profile Picture

Scott_itD 2 Community Manager

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans