Dynamics AX – Accessing Data for Multiple Companies

Have you ever had to compare data for several companies in Microsoft Dynamics AX?

That is usually not a problem to change the company you are currently attached to. You just double-click the company on the bottom of your current work space, and change it.

 

 

 

This becomes more of a challenge when dealing with more than a handful of companies.

That is where the crossCompany and changeCompany keywords can be helpful.

The table DataArea stores the company Id for all companies configured in your environment. Using the crossCompany keyword, you can construct a query to retrieve all records, regardless of the company you are currently logged into. This example loops through all of the companies in the table DataArea, then calls a routine to do some work in that company.

while select crossCompany * from dataArea

{

info (strFmt(“%1 %2”

, dataArea.Id

, dataArea.name

));

showCompany(dataArea.Id);

}

In this example, I just want to know how many customer records exist in each company. This routine will use the changeCompany keyword to define the scope of work. Using this, I can run one job to interrogate all companies that are set up, or you can manually change companies and run the query in each company. You decide which is more efficient.

void showCompany(DataAreaId _dataAreaId)

{

CustTable   custTable;

;

changeCompany(_dataAreaId)

{

custTable = null;

select count(RecId) from custTable;

info (strFmt(”  Company: %1, # of Customers: %2″

, _dataAreaId

, custTable.RecId

));

}

return;

}

To learn more about how Tridea Partners can help you get the most out of your Microsoft Dynamics AX solution, visit www.trideapartners.com or contact us at info@trideapartners.com.

The NEW Dynamics AX Webinar

The official release of the New Microsoft Dynamics AX (formerly known as Dynamics AX 7) is available.  Join Tridea as we host this webinar on an overview of the NEW Microsoft Dynamics AX release!

Join us for this webinar, Topics include:

  • Dynamics AX moving to the cloud
  • License changes
  • Deprecated features
  • A demo of the new web based Microsoft Dynamics AX

Date: Tuesday, May 31, 2016  at  10:00 AM to 11:00 PM (PT)

register here

Dynamics AX 2012 : Quick Way to Copy or Reverse a Journal

There are a couple of ways to reverse a journal in Microsoft Dynamics AX. One is to use the “Reverse transaction” option from the GL inquiry screens.  This is a quick and easy way to reverse entries, but there are many entries which cannot be reversed, and when transactions are reversed, they are automatically posted without being processed by a workflow or an approval group which is a problem for many organizations.

The other option is to use the “Load ledger balances” functionality in the journal screen to load a journal that has already been posted. This is really a copy function that can be used to copy a prior journal with reversed transactions which can then be routed through an approval process.

To copy a journal:
  1. Create a general journal as you normally would and click Linesax 2012
  2. In the lines form, click on Functions and then select Load ledger balances.ax 2012
  3. On the Load ledger transactions form:
    • Verify the voucher is set to New voucher number per voucher.
    • Click the Invert sign check box if you would like to reverse the journal.
    • Click Selectax 2012
  4. On the Select screen, enter the Journal number that you would like to reverse or copy and click OKax 2012
  5. You are now back on the Load ledger transactions screen, click OK.ax 2012
  6. Upon clicking OK, AX will load a copy or reversal of the journal you selected in the current journal form. Notice in the case of a reversal, AX inserts the description of Void and the voucher number.ax 2012
  7. You can now submit your journal through the review and approval process and post!

This post was written by Matthew Caffrey, AX Application Consultant at Tridea Partners. Tridea is a leading Microsoft Dynamics provider.