Command Line To Import Data


In Axapta 4.0 you can use the -startupcmd=autorun_ command line option to batch import data is two steps.


 


1. Create an xml file (demoData.xml for example) that looks like this:



<?xml version=”1.0″ encoding=”utf-8″ ?>


<AxaptaAutoRun exitWhenDone=”true” version=”4.0″ logFile=”axautodata.log”>


       <CompanyAccounts >


              <Company name=”Demo Company” id=”DMO” overwrite=”true” />


       </CompanyAccounts>


       <DataImport companyId=”DMO” file=”demoData.dat” />


</AxaptaAutoRun>


 


2. Then launch the client with command line like this:



ax32.exe -startupcmd=autorun_demoData.xml


 


Notice the prefix autorun is added to the xml file name.  Since exitWhenDone is set to “true”, the client will exit after importing the data.


 


You can see a list of all the tags that are handled by the -startupcmd=autorun_ command by looking in the X++ classDeclaration of SysAutoRun.


 


I work on version 4.0, so I don’t know if it also works in 3.0.

Comments (1)

  1. Az says:

    Hi David,

    Thanks for the tip.

    Just need one more help and its

    "How to import an XPO through command line?"

    I would Request you to kindly treat it urgent as we are in a project situation. Your timely help will be great.

    Thanks and Regards

    Az