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 AX (Archived)

Add field in Purchase Order for SSRS report that uses.

(0) ShareShare
ReportReport
Posted on by

New to AX (not live yet).  I am slowly getting through road blocks on making changes to the Purchase Order report.  But there is quite a bit to come up to speed on.  Have already made changes to the form - and they work - but it is only removing fields, moving them, changing things around.  I am not sure where to go for adding the PO Payment Terms description - a field not already set up to appear on the report.  Can someone give me any hints or what to read up on?  I know I have to most likely make changes to code in a class (which I can do once I figure out how) - but like with most stuff like this, it is easy once you have done it once - but that first time can be confusing.  I am finding a dearth of information on the internet since 2012 is fairly new.  I would appreciate either the steps, or get directed to articles that can bring me up to speed.  The company 'helping' us doesn't seem to understand that we don't know what we don't know and won't point us in the correct direction unless we ask exact questions - which is hard to do when one doesn't know what to ask!  They also get paid more if they do the job for us so don't always want to teach us the details.  I am trying to see if I can figure this out faster without their help/$$.

*This post is locked for comments

I have the same question (0)
  • Verified answer
    Andy Adamak Profile Picture
    4,074 on at

    I was in your same shoes last year... I was thrown the AX reporting and said "here, fix these and make them what we want".  General things to note about AX reports, and then we'll get to POs:

    - You can add datasets in 4 different ways from AX, but the most common you'll see is a Report Data Provider class.  This class is usually handed a query defined as an attribute in the classDeclaration which can then be modified and processed (in the processReport method) to fill in a temporary data table(s), which is then handed back to the report for display (get[tableName] method).  Often this is split into one or more "insert" methods.  For POs, your RDP class is PurchPurchaseOrderDP.

    - Reports can also have a Contract class, which is basically a class to declare specific parameters that you'd like to process in your RDP or display on the Report itself and to do some pre-processing.  If you use one, this is also defined as an attribute in the RDP classDeclaration.  For PurchPurchaseOrderDP, you can see it is tagged with "[SRSReportParameterAttribute(classStr(PurchPurchaseOrderContract))]" in its class declaration.  PurchPurchaseOrderContract is the contract class for this report.  

    -Even with an RDP, reports will 99% of the time have a query that it calls, which many times is as I said another attribute of your RDP.  You can modify these queries to add fields, more data sources via joins (relationships), etc.  You'll then have to add the fields to your report's temporary data table.  Then, you can modify your RDP to fill in these fields with the retrieved data.  POs, however, are very different.  They use the "PurchTableAllVersions" and "PurchLineAllVersions" queries to pull data, both of which are already pulling every field from their respective tables.  Unless you're adding custom fields to the tables, there is no need to modify the queries.  

    -After you've modified your query, temp table, and RDP, you can go into VS and refresh the reports dataset to get the new fields in and design from there.

    The trick most of the time is traversing AX's overly-normalized model to find what you're looking for.  Anyway, back to specifically POs, there are several objects you will need to modify.  I would recommend starting with a less complex report (SalesNotInvoiced is very straight forward) to understand how everything is put together, but I'll continue on with the PO stuff.  

    The most important question is... are you adding any fields to the PurchTable or PurchLine table?  AKA, adding custom data to Purchase Orders/ Lines?  We did.  And that's more work.  I'll assume your not.

    The PO has 2 tmp tables: PurchPurchaseOrderHeader and PurchPurchaseOrderTmp.  The header stores the header info (wow!) and the tmp stores your "rows".  Remember those insert methods on the RDP?  Well, for POs they decided to make one of those for the details (setPurchPurchaseOrderDetails), but for the PurchPurchaseOrderHeader they decided to write the methods on the table itself (initFrom***).  Why did they do that?  No clue. I listed what I changed on each object below.

    Objects to modify:

      - PurchPurchaseOrderHeader - Add any extra fields you want to show.  Modify any initFrom*** methods for any added fields from those tables.  For payment terms, assuming you added the field to the table already, it would be  "this.PaymentTerms = _purchTableAllVersions.Payment;"

      - PurchPurchaseOrderTmp - Add any extra fields you want to show.

      - PurchPurchaseOrderController - I only changed the 'documentTitle' method to get our titles on.

      - PurchPurchaseOrderDP - modify setPurchPurchaseOrderDetails() to fill any fields you added to the PurchPurchaseOrderTmp table.

    That should be it.  If you open the report in VS and refresh your dataset (or go in and select the new fields if the dataset doesn't "SELECT * FROM [table]") and your new fields should show up.  

    Good luck on your reporting adventures!

  • Community Member Profile Picture
    on at

    Thanks.  I don't understand everything you posted, but a lot more is clearer.  It should all make sense soon!

  • IDCBIC Profile Picture
    on at

    I know this is an old post, but on the off chance it is still being looked at:

    I'm trying to add the "PriceUnit" field to the Purchase Order Report.  I believe I've done everything that is stated above, but the report data provider still doesn't have the field showing up as an option to select.  Anybody know if "PriceUnit" is special?  I've added the line: purchPurchaseOrderTmp.PriceUnit = purchLineAllVersions.PriceUnit; to the setPurchPurchaseOrderDetail method.  Is there anywhere else I should modify?  I've done compiling of the tmp table, generated incremental CIL, refreshed data, restarted reporting services, and restarted AOS.

  • Community Member Profile Picture
    on at

    Hi Andy Adamak,

     Same Task I am Doing Now Please Tell Me The  Steps My Task Was Adding Two Fileds

    (DlvMode & DlvTerm) Why Im Asking Is All Ready U'r Done This Thing Soo U Know Everything All Ready That Two Fields There In PurchTable Sooo Now Im Traing To Add To PurchPurchaseTmp Table So Please Help Me Andy...

  • Community Member Profile Picture
    on at

    Hi , I hv tried evry hting u hav maentioned , but still some of my fileds are not coming in report and niether they are coming in PurchPurchaseOrderTmp table. I hv applied

    purchPurchaseOrderTmp.BomId                  = ProjBOM::findProjid("ABC-000119").ItemId;

    purchPurchaseOrderTmp.BomItemId              = ProjBOM::findProjid("ABC-000119").BOMId;

    but these values are not coming but when i applied the same in a job just to check if i m getting values or not , I am getting the values.

    I dont know if  I am missing something. Please help , need to develop the report asap , Its critical .

  • Ismail Mohamed Profile Picture
    576 on at

    same issue ?

    any update ?

    report data provider still doesn't have the field showing up as an option to select

  • Ismail Mohamed Profile Picture
    576 on at

    The problem was in refresh data in VS  error (object reference not set to an instance of an object)

    but when i create new vs project and point it to rdp class the new record appeared

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 AX (Archived)

#1
Priya_K Profile Picture

Priya_K 4

#1
Martin Dráb Profile Picture

Martin Dráb 4 Most Valuable Professional

#3
Scott_itD Profile Picture

Scott_itD 2 Community Manager

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans