Thanks alot Michael. You have helped me alot.
--- In Axapta-Knowledge-Village@yahoogroups.com, <mni_...@...> wrote:
>
> Hi,
>
> try CustInvoiceJour.printJournal()
>
> static void printInvoice(Args _args)
> {
> SalesFormletter SalesFormletter;
> printJobSettings printJobSettings;
> CustInvoiceJour CustInvoiceJour;
> ;
> SalesFormletter =
> SalesFormletter::construct(DocumentStatus::Invoice,false);
>
> printJobSettings = new printJobSettings();
> printJobSettings.setTarget(PrintMedium::File);
> printJobSettings.format(PrintFormat::PDF);
> printJobSettings.fileName(@'H:\Temp\Test.pdf');
>
>
> SalesFormletter.updatePrinterSettingsFormLetter(printJobSettings.packPrintJobSettings());
>
> Select CustInvoiceJour Where CustInvoiceJour.SalesId == 'SO-101247';
>
> CustInvoiceJour.printJournal(SalesFormletter);
> }
>
> Best regards
> Michael
>
>
> From: giridharraj
> Sent: Thursday, December 03, 2009 11:36 AM
> To: Axapta-Knowledge-Village@yahoogroups.com
> Subject: [Axapta-Knowledge-Village] generate sales invoice report through
> code and save as pdf file in file system.
>
>
>
> Hi,
>
> I have written the following code to generate a sales invoice report and save
> as a pdf file in the file system. But this code is not saving the report as
> pdf instead it is displaying the report on the screen. can anyone correct
> this code..........
>
> CustInvoiceJour InvJTbl;
> SalesId Id;
> ReportRun report;
> SalesFormLetter_Invoice SalesFormLetter = new SalesFormLetter_Invoice(false);
> RecordSortedList List = new RecordSortedList(62);
>
> Id = "SO-0000123";
>
> Select InvJTbl Where InvJTbl.SalesId == Id;
> List.ins(InvJTbl);
> report = new ReportRun(new Args(ReportStr(SalesInvoice)));
> report.args().caller(SalesFormLetter);
> report.args().parmEnum(1);
> report.args().parmEnumType(920);
> report.args().object(List);
> report.args().name("KeepSettings");
> report.printJobSettings().setTarget(PrintMedium::File);
> report.printJobSettings().format(PrintFormat::PDF);
> report.printJobSettings().fileName("C:\\Temp\\Test.pdf");
> report.prompt();
> SalesFormLetter.updatePrinterSettingsFormLetter(report.packPrintJobSettings());
> report.run();
>