The Batch Job can be
created in Different manners. I am explaining one way for it.
Steps:
Steps:
Create a class for the
logic what you want you want to do.
Add this class with the
Batch Job.
run the Batch Job.
Note: If you want to run
the batch job in the client mode to one more step needed.
4) run the batch job in client mode.
4) run the batch job in client mode.
Step:1
I am creating a simple
class .
go to classes node in the AOT. create a New Class name it. Open Class Declaration
and extend it to the RunBaseBatch class.
go to classes node in the AOT. create a New Class name it. Open Class Declaration
and extend it to the RunBaseBatch class.
class Batch4Demo extends
RunBaseBatch
{
{
}
after this override the
run method of the class. Right click on the class in the AOT go to Override and
select run method. in this run methode write your own logic like as shown
bellow.
public void run()
{
public void run()
{
//Code logic
}
}
after this override pack
and unpack methods.
public container pack()
{
return conNull();
}
public boolean unpack(container packedClass)
{
return true;
}
public container pack()
{
return conNull();
}
public boolean unpack(container packedClass)
{
return true;
}
now create a main method
foe the class and call the run method in that
(this is very important
with out main you cant run the class)
right click and add new
method write following code.
private void main(Args
_Args)
{
Classname b = new classname(); //name of
the class
b.run();
}
Step:2
Create a Job in the Job
Node of AOT write the following code in it.
static void
EEMC_SecurityRoleBatch(Args _args)
{
BatchHeader batHeader;
BatchInfo batInfo;
RunBaseBatch srTask;
str sParmCaption = "Security Role
Update Batch Job";
;
srTask = new classname();
batInfo= srTask .batchInfo();
batInfo.parmCaption(sParmCaption);
batInfo.parmGroupId(""); // The
"Empty batch group".
batHeader = BatchHeader ::construct();
batHeader.addTask(srTask);
batHeader.save();
info(strFmt("'%1'
batch has been scheduled.", sParmCaption));
}
Step:3
Now Compile the Job And
Class. run the Batch Job by pressing F5.
Before running Generate
the IL code. Go to Build and click on Generate Incremental CIL..
It will create a Batch job
in the Batch Jobs Form you can view it by going into the
following path
System Administration
--> Inquiries --> BatchJobs --> Batch Jobs.
You should see the status
as waiting---> Executing --> Ended in the status column
of the Batch Jobs form.
Now the above batch job
will run only on the server.
If you want to make it run
on the Client. follow bellow steps.
Step:4
Override the method
runsImpersonated. Right click on the Batch4Demo class and override the above
method write the following code in it.
public boolean
runsImpersonated()
{
// false means that the batch must run on a client.
return false;
}
{
// false means that the batch must run on a client.
return false;
}
Now run the class as
mentioned above.
After running it we have
to add it to the client section to do this.
Go to Organization
administration --> Basic Or Periodic --> Batch Processing.
open the form and you can
see batch group and private check box option.
in the group option select
empty group( Because in the above code we have selected empty in the batch
group). uncheck the private. now click ok. the batch job will run.
No comments:
Post a Comment