Developing for Dynamics GP

by David Musgrave (Perth, WA, Australia) and the Microsoft Dynamics GP Developer Support Team (Fargo, ND, USA)

Finding out how to call an existing Report

Finding out how to call an existing Report

  • Comments 5

David Meego

Over the years, I have been asked many times how to call a Report Writer report to make it behave the same as if it was called by the original code.

If you are member of the Source Code program, you could always find the run report command in the source script and that would provide the information about the Restrictions or Legends passed.  However, this information can be obtained without needing access to the source code.

The Dexterity Report Writer has a debugging feature which we can leverage to obtain the information we need.  There are two methods of activating the DebugRW functionality:

  1. Use the Support Debugging Tool, Tools >> Support Debugging Tool >> Options >> Dex.ini Settings >> Reports.  Mark the "Logs the run report statement as the Report Writer sees it" checkbox.
     
  2. Manually add DebugRW=2 setting to the DEX.INI file.

Once active, every time the Report Writer runs a report it will append to the DebugRW.txt file the details of how the report was called. 

Below is the information logged for when the 'RM Customer Report' was printed from the Customer Maintenance window for customer "Aaron Fitz Electrical":

rw_init();

run report 'RM Customer Report' (256)
 legends "        Current",
  "   31 - 60 Days",
  "   61 - 90 Days",
  "  91 - 120 Days",
  "AARONFIT0001 - AARONFIT0001",
  "Aaron Fitz Electrical - Aaron Fitz Electrical",
  "USA-ILMO-T1 - USA-ILMO-T1",
  "Retail - Retail",
  "PAUL W. - PAUL W.",
  "TERRITORY 1 - TERRITORY 1",
  "Aaron Fitz Elec - Aaron Fitz Elec",
  "98052-6399 - 98052-6399",
  "WA - WA",
  "42555501010000 - 42555501010000",
  "Bob Fitz - Bob Fitz",
  "by Debtor ID",
  "Type:",
  "User-Defined 2:",
  "Registration"
( RM_Customer_MSTR(141).Customer Number(493) = "\012AARONFIT0001   " ) report queued with result = 1

rw_term();

NOTE: The Resource ID information in brackets for the report, table and fields.  You can use the Resource Information window in the Support Debugging Tool to cross reference resources by their ID.  This is sometimes useful when the name of the resource is not shown correctly and displays '[Not Found]'.

The Restriction is shown in the Table.Field format and will need to be converted to the Field of table Table format for the actual Dexterity call.  The Legends will probably need a little analysis to identify what information is being passed to the report.  You might need to change options and print the report again to see what changes the options can make to the legends.  Once you have the legends identified you can then place the values into the string fields to pass to the report.

Based on the information captured, you will be able to generate a run report command similar to one below:

Example Report Writer Call

run report 'RM Customer Report' with restriction
 'Customer Number' of file RM_Customer_MSTR = 'Customer Number'
 legends
 l_legend1, l_legend2, l_legend3, l_legend4,l_legend5,
 l_legend6, l_legend7, l_legend8, l_legend9, l_legend10,
 l_legend11, l_legend12, l_legend13, l_legend14, l_legend15,
 l_legend16, l_legend17, l_legend18, l_legend19;

As you can see this technique can be used to help a developer understand how they can call existing reports. 

David

Page 1 of 1 (5 items)
Comments Information

PLEASE READ BEFORE POSTING

Please only post comments relating to the topic of this page.

If you wish to ask a technical question, please use the links in the links section (scroll down, on right hand side) to ask on the Newsgroups or Forums. If you ask on the Newsgroups or Forums, others in the community can respond and the answers are available for everyone in the future.

Leave a Comment
  • Please add 8 and 5 and type the answer here:
  • Post