Skip to main content

Notifications

Small and medium business | Business Central, N...
Answered

Printing 2 reports in a sequence business central

(0) ShareShare
ReportReport
Posted on by 162

Hi guys, 

I am having a problem with printing 2 reports (sales shipment and sales invoice) in a sequence by manually calling the print records functions on the respective records in BC20 On Premises. Its only printing the second report but both documents are incrementing the number printed field.

Any idea what could be causing this? 

  • Rebe.Gwaindepy Profile Picture
    Rebe.Gwaindepy 162 on at
    RE: Printing 2 reports in a sequence business central

    Hi guys,

    it looks like this is not possible as of now because of browser limitations:

    docs.microsoft.com/.../report-run-method

  • Verified answer
    Rebe.Gwaindepy Profile Picture
    Rebe.Gwaindepy 162 on at
    RE: Printing 2 reports in a sequence business central

    Thank you, if all fails then i will have to go this route.

  • Rebe.Gwaindepy Profile Picture
    Rebe.Gwaindepy 162 on at
    RE: Printing 2 reports in a sequence business central

    My report selections is defined ok with report 1308 for D Note. If i flip the code to print invoice first, then it will print D notes only. I have also debugged and indeed the system is calling the reports (and they increment No. printed). Is your post and print function for Cash receipt journal printing both GL register and Customer payment report?

  • Suggested answer
    YUN ZHU Profile Picture
    YUN ZHU 76,948 Super User 2025 Season 1 on at
    RE: Printing 2 reports in a sequence business central

    Hi, I'm not sure if this will help you, I have used the solution below to combine different reports into the one PDF and letting the client print this PDF.

    Merge PDF in Business Central (linkedin.com)

    Source: GitHub - gonzaloriosley/Merge-PDF-Business-Central

    Hope this helps.

    Thanks.

    ZHU

  • Suggested answer
    Inge M. Bruvik Profile Picture
    Inge M. Bruvik 995 Super User 2024 Season 1 on at
    RE: Printing 2 reports in a sequence business central

    Could not find anything obvious in the code.

    Have you defined a report for the sales shipment in report selection sales?

    The printrecord function seems to depend on what is defined in report selection sales.

    And have you checked with printrecord(true) to check if the request form actually is executed?

  • Rebe.Gwaindepy Profile Picture
    Rebe.Gwaindepy 162 on at
    RE: Printing 2 reports in a sequence business central

    Below is the code i am using for printing(i am calling this procedure after posting all orders and i commit):

       procedure PrintDispatchDocuments(DeliveryOrderHeader: Record "ADV Delivery Order Header"; )

       var

           SalesShipmentHeader: Record "Sales Shipment Header";

           SalesInvoiceHeader: Record "Sales Invoice Header";

       begin

           //>> Delivery Notes

           SalesShipmentHeader.reset();

           SalesShipmentHeader.SetRange("Delivery Order No.", DeliveryOrderHeader."No.");

           SalesShipmentHeader.FindSet(true);

           repeat

               SalesShipmentHeader.PrintRecords(false);

           until SalesShipmentHeader.Next() = 0;

           //<<Delivery Notes

           //>> Delivery Invoices

           SalesInvoiceHeader.Reset();

           SalesInvoiceHeader.SetRange("Delivery Order No.", DeliveryOrderHeader."No.");

           SalesInvoiceHeader.FindSet(true);

           repeat

               SalesInvoiceHeader.PrintRecords(false);

           until SalesInvoiceHeader.Next() = 0;

           //<<Delivery Invoices

       end;

  • Suggested answer
    Inge M. Bruvik Profile Picture
    Inge M. Bruvik 995 Super User 2024 Season 1 on at
    RE: Printing 2 reports in a sequence business central

    Maybe you can share the code you are using ?

    Often easier to see whats going on then.

  • Rebe.Gwaindepy Profile Picture
    Rebe.Gwaindepy 162 on at
    RE: Printing 2 reports in a sequence business central

    Hi ZHU, thanks for the response. :-), I am a huge fan. Unfortunately for my case i cant use this feature because i a printing report 1306 and 1308.  As a side note, is there a way to call post and print for a number of orders in a sequence with Commit Suppressed?

  • Rebe.Gwaindepy Profile Picture
    Rebe.Gwaindepy 162 on at
    RE: Printing 2 reports in a sequence business central

    I am using the print to pdf printer as my default printer on my machine and it automatically downloads the files. I am certain they are not being saved elsewhere.

  • Rebe.Gwaindepy Profile Picture
    Rebe.Gwaindepy 162 on at
    RE: Printing 2 reports in a sequence business central

    Hello everyone, thanks for the responses. My situation is like this: We have Shipment and Delivery addition to the Sales process that combines various sales orders to one "Delivery Order" for shipment and Invoicing, so when the user Dispatches the delivery order it posts all sales orders and afterwards Prints the Shipments  and Invoices using the Record.PrintRecords function . Everything is going well up to the point of printing, BC is only printing the last print command (Invoices). The No. printed for shipment is increasing (i can see the print command is running)  but somehow the actual print does not happen.

    In the meantime i had to put a confirmation of print After the Shipments command and they all print fine, for now. I would appreciate if you suggest another way i can handle this.

    I see an almost similar issue was reported here but on BC15 here.

    pastedimage1660758323504v1.png

    I have attached a screenshot for a better overview of the process.

    Thanks,

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

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Announcing Forum Attachment Improvements!

We're excited to announce that attachments for replies in forums and improved…

Vahid Ghafarpour – Community Spotlight

We are excited to recognize Vahid Ghafarpour as our February 2025 Community…

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,979 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 230,848 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans