web
You’re offline. This is a read only version of the page.
close
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

I have the same question (0)
  • Suresh Kulla Profile Picture
    50,243 Super User 2025 Season 2 on at

    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 

  • Community Member Profile Picture
    on at

    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' ?

  • Suggested answer
    Suresh Kulla Profile Picture
    50,243 Super User 2025 Season 2 on at

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

  • Community Member Profile Picture
    on at

    73248.Capture.PNG

  • Suggested answer
    Suresh Kulla Profile Picture
    50,243 Super User 2025 Season 2 on at

    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.

  • Community Member Profile Picture
    on at

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

  • Suggested answer
    Suresh Kulla Profile Picture
    50,243 Super User 2025 Season 2 on at

    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.

  • Suggested answer
    Andrey Baludin Profile Picture
    3,941 on at

    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.

  • Verified answer
    Community Member Profile Picture
    on at

    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.

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics NAV (Archived)

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans