Options

Specific SAVEASPDF question

compwizardcompwizard Member Posts: 17
edited 2011-05-20 in NAV Three Tier
Hi Guys,

I have a specific requirement that whenever a Purchase Order is posted, (the user pushes the POST button in the RTC) a PDF of that order is saved.

I'm using the brilliant SAVEASPDF which works great, but can't for the life of me figure out the syntax! ](*,)

I'm in the Object Designer > Page > Purchase Order > Design > View > Actions > F9 on P&ost

Just after
.
.
.
CODEUNIT.RUN(CODEUNIT::"Purch.-Post (Yes/No)",Rec);
REPORT.SAVEASPDF(REPORT::"Order",'C:\temp\poimage.pdf',Rec);

As I mentioned, works fine, but obviously I end up with the entire Order report. What would the C/AL need to look like to just save the PDF of that order?

Thanks in advance!

Comments

  • Options
    mohana_cse06mohana_cse06 Member Posts: 5,503
    Just a guess..
    take a variable and get the document no from rec before calling the Codeunit and use that variable in saveaspdf function..
  • Options
    pdjpdj Member Posts: 643
    Several problems with your approach...
    First of all - you need to print the order before you post it, as invoicing might delete it.
    Secondly - you need to set a filter on the variable passed to the report, otherwise it will print all records
    Finally - if you wish to print the invoice (and not the order) you will need to find somewhere inside the posting codeunit, where the invoice is fully created and the number is known.
    Regards
    Peter
  • Options
    mohana_cse06mohana_cse06 Member Posts: 5,503
    Try this


    END ELSE BEGIN
    PurchHeader.RESET;
    PurchHeader.SETRANGE("Document Type",PurchHeader."Document Type"::Order);
    PurchHeader.SETRANGE("No.","No.");
    IF PurchHeader.FINDFIRST THEN;
    CODEUNIT.RUN(CODEUNIT::"Purch.-Post (Yes/No)",Rec);
    REPORT.SAVEASPDF(REPORT::Order,'C:\NAV\Purchase.pdf',PurchHeader);
    END;
Sign In or Register to comment.