Click here to Skip to main content
65,938 articles
CodeProject is changing. Read more.
Articles / database / SQL-Server / SQL-Server-2008

Dynamics AX Data Maintenance & Migration Tips

5.00/5 (1 vote)
29 Jun 2012CPOL5 min read 19.8K  
Maintenance of Definition's in multiple Dynamics AX Environments

Introduction

This article is intended primarily for intermediate Microsoft Dynamics AX users who are familiar with AX User Interface. The Goal of this article is to help the users by providing the tips on maintaining/moving “Definition Groups” between different Dynamics AX environments. The focus of this article is not the data, but to advise/teach on maintaining the same “Definitions” across different AX environments.

Basically the DAT/DEF is used to Export/Import data between AX AOS Servers. In general, Microsoft Dynamics AX data import/export is used to move data from a staging environment to another environment. Definition groups identify groups of tables that can be imported or exported when you use Microsoft Dynamics AX data import/export under System Administration. Definition groups must be set up before you export data, but are not required when you import data.

To the best of knowledge know such article was found which explains/focuses on how to export the Definition file along with the predefined list of tables and criteria, a Setup that was created and want to carry it to other Environments without recreating it.

Note : List of tables and "Criteria’s" and "Ranges" selected on each table under a definition group are stored in the SYSEXPIMPTABLEQUERY table.

SQL
SELECT GROUPID, QUERYRANGE, QUERYPACKED FROM SYSEXPIMPTABLEQUERY

Follow the steps here.

LogIn into AX : The user should have AX "System Adminstrator" Role to navaigate to the below screen.

Navigate to System administration | Common | Data export/import

Note : Here in the below demonstration Trans and Ex_def are used as sample names, this could be replaced with any name of users choice. In the below example Trans Definition is exported using Ex_def group. Exporting the definition groups is possible by using another Definition group.

Lets assume that you have some tables already defined in the group named “Trans” as an example shown in the below Image and wanted to export that definition file to another AX environment.

To export the above definition file with the same set of Tables and criteria's, you need to create another definition file which can do the trick to export it for us. So create a new definition group as "Ex_def" and save the description as “Export Definitions” so that it is clear in understanding the purpose of it.

See that all the check boxes under "Options" tab and "Include table groups" tab are unchecked. This way you are not loading any tables into this new definition. The user should see a new record like the one shown in the below image. Click “Select tables” from menu bar.

Select tables” will take the user to the screen as shown below.

In “Select tables” Form just type the “Name of the table” Column as “SysExpImpGroup” in it. And check or select the box “Apply criteria” column and click the “Export criteria” from the Menu bar on the top of the form.

Clicking on “Export criteria” should take you to the below screen.

This Form helps in creating a query on SysExpImpGroup table(Define import/export groups). Select the name of the definition (ex : "Trans") from the dropdown in the "Criteria" column which was intended to move into another AX environment and click OK button at the bottom of the form.

This should take you back to "Select tables" Form. Then select the checkbox under “Specify related tables” as shown in the below screen and click on the “Select related tables” on the top of the Form menu bar.



Clicking the “Select related tables” will present you with the following form with a list of tables.

Do not modify anything in this form, leave that as it is and close it. You should see the entire above displayed tables back in the “Select tables” Form as shown in the below image.



System administration | Common | Data export/import | Export to

This will take you to the "Export Options" Form as shown in the below Image.

In “Export Options” form, Select the Ex_Def from the "Definition group“ dropdown and select the Binary from the "File type" dropdown and pass the name of the output File as Trans.dat. This exported file contains all the tables and criteria’s & ranges information when selected Binary Format as "File Type" output instead of Comma. Import this DAT and DEF files into new AX Environment. You should see the definition group with the same name Trans in the new AX environment as well. It will have all the Table names, Ranges and criteria’s intact. This avoids the user to recreate/redo them from scratch again and saves a lot of time to the developers.

Note: If the file is exported in Comma format then you will only be able to get the Tables information, but not the ranges and Criteria's. Hope Microsoft fixes this in the near future.

Importing the DAT/DEF files could also be done through command line using an XML file as Input to AX32.exe.

XML file should be some thing like this.

XML
<?xml version="1.0" encoding="utf-8"?>
         <AxaptaAutoRun exitWhenDone="true" version="6.0"> 
  <DataImport companyId="DAT" file="C:\tfs\AxCore.dat" definitionGroupId="AxCore"/>             
</AxaptaAutoRun>

Note : Aviod spaces in the Parameter values in XML file.

Run the below command line in Command Prompt window.

ax32.exe -internal=noModalBoxes -StartupCmd=AutoRun_C:\tfs\AxCoreAutoRun.xml

References

The below link might also be useful to the AX developers

http://blogs.bojensen.eu/?p=527

Conclusion

The above mentioned demonstration of steps determine that exporting the Definition groups which holds the List of tables along with criteria's and ranges could also be migrated to different AX environments easily.

I would dedicate this article to all my well-wishers, friends and colleagues. My special thanks to Richard Ward, John Reed and Todd Oberman.

Hope this article will serve the purpose. Any suggestions or corrections are most welcome.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)