FAQ - axapta 2009 - Asked By surabhi on 21-Jul-11 01:09 AM

Hi All,

 
 I need to know how to create and run a batchjob in ax 2009

Thanks
Surabhi Kansal
Jitendra Faye replied to surabhi on 21-Jul-11 01:13 AM
Follow these steps-
 
1. Create a batch group named Test and set up the relating batch jobs for this group.

2. In the class SysStartupCmdBatchRun, modify the method infoRun as below:
   void infoRun()
  {
      batchRun batchRun = new batchRun();
      ;
      batchRun.parmGroupId(parm);
      batchRun.parmUseForm(true);
      batchRun.parmGroupId(parm);
      batchRun.run();
   }

3. Open Axapta Configuration Utility, create a new configuration, in our example it is Test4BatchConf. Copy the active configuration to Test4BatchConf, then type Batch_Test in Startup command field.   Export this Configuration to C:Test4BatchConf.xpo.

4. Create a short-cut for Ax32.exe in your desktop. Right click this short-cut to view its property. In the short cut tab, in our example the location of Ax32.exe is c:MBSClientbinAx32.exe (in this case, no space is allowed in the file path, like Program files, otherwise it will generate errors). Change the string in target field from c:MBSClientbinAx32.exe to  c:MBSClientbinAx32.exe -regimport=C: Test4BatchConf.xpo -regconfig= Test4BatchConf.
Close the short-cut for Ax32 in your desktop.

5. In Windows XP, click Start->All programs->Accessories->System Tools->Scheduled Tasks. Click the icon Add Scheduled Tasks, then open the wizard which will guide you through the setup of Scheduled Tasks; click next, then you can see a window to allow you specify programs. Click browse, choose the short-cut for Ax32.exe which you created in your desktop. Type in the task’s name and specify the type of scheduled task. In our example, we specify Test4AxBatch as the task’s name and  daily as the type of task. And we need to run this task 5PM every day. Before you close the wizard please select the check box Open advanced properties for this task when I click Finish. In the Task tab, change the string in Run field from c:MBSClientbinAx32.exe to  c:MBSClientbinAx32.exe -regimport=C: Test4BatchConf.xpo -regconfig= Test4BatchConf.

Here we have it, an automatic daily batch job .
Riley K replied to surabhi on 21-Jul-11 01:22 AM
In order to process batch jobs you need batch server running.
Goto Basic->Inquries->Batch->Batch processing and select batch group you want to process. Your job must be attached to this group. Click OK and in 2mins you will get your job running.
Riley K replied to surabhi on 21-Jul-11 01:24 AM
Continue..

Note that you have to activate AOS first,
,
to run batch job in AX 2009 you must "activate" a AOS to be a batch server.

Please go to the Serverconfiguration (Administration->Setup->Server
configuration).

Make sure that the option "Is Batch Server" is activated for your AOS(es).

Also make sure that the other Batch configurations like schedule and
"selected" Batch Groups are configured.
Reena Jain replied to surabhi on 21-Jul-11 01:25 AM
Hi,

You have a batch class that overrides the runImpersonated method. The override makes the batch eligible to run only on a client computer. You run a job that schedules the batch. The batch remains in a waiting status until you use the client to tell the AOS to send the client-bound batch to your client now so the batch can run.

In this procedure, you will use the Navigation Pane to tell the AOS to send client-bound batches to your client.

To run your batch on the client

  1. In the Navigation Pane, click Basic, expand Periodic, expand Batch, and then click Processing. This displays the form Set up batch processing.

  2. Click the drop-down list, and then select Empty batch group. Batch tasks in this group will be run.

  3. Make sure the check box labeled Private is clear.

  4. Click OK to start the Batch processing form.

Hope this will help you
Reena Jain replied to surabhi on 21-Jul-11 01:30 AM
Hi,

here are the steps

1. Create a batch group named Test and set up the relating batch jobs for this group.
2. In the class SysStartupCmdBatchRun, modify the method infoRun as below:
   void infoRun()
  {
      batchRun batchRun = new batchRun();
      ;
      batchRun.parmGroupId(parm);
      batchRun.parmUseForm(true);
      batchRun.parmGroupId(parm);
      batchRun.run();
   }

3. Open Axapta Configuration Utility, create a new configuration, in our example it is Test4BatchConf. Copy the active configuration to Test4BatchConf, then type Batch_Test in Startup command field.   Export this Configuration to C:Test4BatchConf.xpo.
4. Create a short-cut for Ax32.exe in your desktop. Right click this short-cut to view its property. In the short cut tab, in our example the location of Ax32.exe is c:MBSClientbinAx32.exe (in this case, no space is allowed in the file path, like Program files, otherwise it will generate errors). Change the string in target field from c:MBSClientbinAx32.exe to  c:MBSClientbinAx32.exe -regimport=C: Test4BatchConf.xpo -regconfig= Test4BatchConf.
Close the short-cut for Ax32 in your desktop.
5. In Windows XP, click Start->All programs->Accessories->System Tools->Scheduled Tasks. Click the icon Add Scheduled Tasks, then open the wizard which will guide you through the setup of Scheduled Tasks; click next, then you can see a window to allow you specify programs. Click browse, choose the short-cut for Ax32.exe which you created in your desktop. Type in the task’s name and specify the type of scheduled task. In our example, we specify Test4AxBatch as the task’s name and  daily as the type of task. And we need to run this task 5PM every day. Before you close the wizard please select the check box Open advanced properties for this task when I click Finish. In the Task tab, change the string in Run field from c:MBSClientbinAx32.exe to  c:MBSClientbinAx32.exe -regimport=C: Test4BatchConf.xpo -regconfig= Test4BatchConf.
Here we have it, an automatic daily batch job .

hope this will help you

Anoop S replied to surabhi on 21-Jul-11 04:07 AM
You can design your own batch job by extending the RunBaseBatch class. You can also write code to schedule the batch to run.

By default, after a batch is scheduled, the batch is no longer associated with the client. The batch runs on the Application Object Server (AOS). However, you have the option to make a batch run on a client.
This walkthrough illustrates the following tasks:
Configuring your AOS batch server
Extending the RunBaseBatch class
Scheduling your batch
Viewing your scheduled batch
Making your batch dependent on a client session
Running your batch on the client

refer this for more details
http://msdn.microsoft.com/en-us/library/cc636647.aspx
Radhika roy replied to surabhi on 21-Jul-11 10:03 AM
Batch processing allows you to run a job, that requires a large amount of computer power, on another, faster computer.
 Batch jobs, once they are activated to run, are sent to a batch list, where they are queued, and will eventually be ran.


you can simply start one more instance of Axapta client and go to Basic -> Periodic -> Batch -> Processing
specify there batch group which this instance should take care of and that's basically it.

In order to start an Axapta client as a batch server instance you can specify special command line parameter using -startupcmd switch.

It should look like this: -startupcmd=batch.

The starting of batch using -startupcmd parameter involves these four classes:

Application,
SysStartupCmd,
SysStartupCmdBatchRun and
BatchRun

In order to specify a batch group using the -startupcmd parameter use this kind of startup parameter: startupcmd=batch_invoice

follow this link-

http://axaptabuilder.blogspot.com/2006/04/how-to-setup-axapta-batch-server.html


Hope this will help you.
Radhika roy replied to surabhi on 21-Jul-11 10:06 AM

Batch processing allows you to run a job, that requires a large amount of computer power, on another, faster computer.
 Batch jobs, once they are activated to run, are sent to a batch list, where they are queued, and will eventually be ran.


you can simply start one more instance of Axapta client and go to Basic -> Periodic -> Batch -> Processing
specify there batch group which this instance should take care of and that's basically it.

In order to start an Axapta client as a batch server instance you can specify special command line parameter using -startupcmd switch.

It should look like this: -startupcmd=batch.

The starting of batch using -startupcmd parameter involves these four classes:

Application,
SysStartupCmd,
SysStartupCmdBatchRun and
BatchRun

In order to specify a batch group using the -startupcmd parameter use this kind of startup parameter: startupcmd=batch_invoice

follow this link-

http://axaptabuilder.blogspot.com/2006/04/how-to-setup-axapta-batch-server.html


Hope this will help you.