This post is machine-translated. The original post in german language can be found here.

AX 2012: Print document through code

With the following job you can reprint an order confirmation by code and have it output as a PDF file.

With the help of similarly named classes such as the SalesConfirmJournalPrint used here, it should also be possible to reprint other documents such as invoices or delivery notes.

static void printSalesConfirmThroughCode(Args _args)
{
    SalesConfirmJournalPrint SalesConfirmJournalPrint;
    set set = new set(Types::Record);
    SRSPrintDestinationSettings SRSPrintDestinationSettings;
    
    // Add record
    set.add(CustConfirmJour::findRecId(5637150827));
    
    // Set printer settings
    SRSPrintDestinationSettings = new SRSPrintDestinationSettings();
    SRSPrintDestinationSettings.fileFormat(
        SRSReportFileFormat::PDF);
    SRSPrintDestinationSettings.fileName(@'c:ab.pdf');    
    SRSPrintDestinationSettings.printMediumType(
        SRSPrintMediumType::File);
    SRSPrintDestinationSettings.numberOfCopies(1);
    SRSPrintDestinationSettings.overwriteFile(true);
    
    // Initalize 
    SalesConfirmJournalPrint = SalesConfirmJournalPrint::construct();
    SalesConfirmJournalPrint.parmPrintFormletter(NoYes::Yes);
    SalesConfirmJournalPrint.parmUsePrintManagement(false);
    SalesConfirmJournalPrint.parmPrinterSettingsFormLetter(
        SRSPrintDestinationSettings.pack());
    
    // Print
    SalesConfirmJournalPrint.printJournal(set); 
}
These post applies to following version:
Dynamics AX 2012

Add comment
 
 

 

 
 
 
Posts of the actual month
Februar 2024
MoTuWeThFrSaSu
 1234
567891011
12131415161718
19202122232425
26272829 
 
© 2006-2024 Heinz Schweda | Imprint | Contact | German version | Mobile version
In order to provide you with better service, this site uses cookies. By continuing to browse the site, you are agreeing to our use of cookies.