Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics NAV (Archived)

Print a report from C/AL

(0) ShareShare
ReportReport
Posted on by

Hi

I'm new in the Dynamic nav world so excuse my lack of knowledge.

I've create a new report (works perfectly) and now i want to create a button to call this report.

I have create an action to call the report and now i try with C/AL code to run the report. I have try to use the REPORT.RUNMODAL fonction but i  need the report ID. I found the table 77 Report Selections but i don't understand the "Usage" fields.

So here's my question :

  • How can i print from C/AL code without the report ID ?
  • How do i get the Report ID ?
  • How i insert information in the "Report Selections" table ?

Thanks for the answers

*This post is locked for comments

  • Verified answer
    RE: Print a report from C/AL

    Hi

    I finally find the solution how ton insert a new "usage" in the table "Report Selections"

    Thanks for helping me :)

    When I open the table in design i found this

    All the permitted value for the field "USAGE" are stock in the properties "OptionString".

    So i Add the value "Manifest" and work perfectly.

  • Suggested answer
    Andrey Baludin Profile Picture
    Andrey Baludin 3,941 on at
    RE: Print a report from C/AL

    3 easy ways to run the report.

    1. REPORT.RUN(number);

    number(or report ID it's number of your report in object designer. 50000 for example).

    Also you can add here extra parameters:

    REPORT.RUN(number, UseRequestWindow, UseSystemPrinter, Record);

    Last 3 parameters are not mandatory, you can only set number of report.

    2. Create local variable with type Report and with id = your report number.

    Add code:

    MyReportVariable.RUN;

    on your action

    3. And the simplest way:

    Open your action properties, find RunObject property and type there Report XXXXX, there XXXXX - your report number.

    No coding at all.

  • Suggested answer
    Suresh Kulla Profile Picture
    Suresh Kulla 44,656 on at
    RE: Print a report from C/AL

    Report Selection Table but I would rather add a new integer field on one of the setup tables, if the the report is customized version of the standard report then you can use the Report Selections to specify your Report No.

  • RE: Print a report from C/AL

    What's the table name where I can add a new "Usage" ?

  • Suggested answer
    Suresh Kulla Profile Picture
    Suresh Kulla 44,656 on at
    RE: Print a report from C/AL

    There is no usage type called Manifest, you need add that to the Usage Type of the Report Selection table or you could add a new integer field on the Sales & Receivables or Purchases & Payables Setup and use that instead of Report Selections.

  • RE: Print a report from C/AL

    73248.Capture.PNG

  • Suggested answer
    Suresh Kulla Profile Picture
    Suresh Kulla 44,656 on at
    RE: Print a report from C/AL

    Please send us the screenshot how are you adding the entry ? Are you adding it directly in the table ?

  • RE: Print a report from C/AL

    When i try to insert my report in the table "Report Selections" i got this error

    Your Entry is not an acceptable value for 'Usage'.

    How can i add a acceptable value for 'Usage' ?

  • Suresh Kulla Profile Picture
    Suresh Kulla 44,656 on at
    RE: Print a report from C/AL

    To print the report or save as pdf with report ID, you need to specify that report ID in the Report Selections based on the usage type.  You can search for Report Selections in the client and specify your report ID if it is a custom report and then use that in your code something like this

    ReportSelection.RESET;
    ReportSelection.SETRANGE(Usage,ReportSelection.Usage::"S.Invoice");
    IF ReportSelection.FINDFIRST THEN
    REPORT.RUN(ReportSelection."Report ID",FALSE,FALSE,SalesInvHeader);

    Check the codeunit 82 for example 

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

Daivat Vartak – Community Spotlight

We are honored to recognize Daivat Vartak as our March 2025 Community…

Announcing Our 2025 Season 1 Super Users!

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

Kudos to the February Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 292,516 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 231,409 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans