How to create an X++ batch job in Axapta 3.0?

帅比萌擦擦* 提交于 2019-12-05 13:47:52

Here's the bare minimum needed to create a batch job in AX:

Create a batch job by creating a new class that extends the RunBaseBatch class:

class MyBatchJob extends RunBaseBatch
{
}

Implement the abstract method pack():

public container pack()
{
    return connull();
}

Implement the abstract method unpack():

public boolean unpack(container packedClass)
{
    return true;
}

Override the run() method with the code you want to execute:

public void run()
{
    ;
    ...
    info("MyBatchJob completed");
}

Add a static main method to your class to create an instance of your class and call the standard RunBaseBatch dialog:

static void main(Args _args)
{
    MyBatchJob myBatchJob = new MyBatchJob();
    ;
    if(myBatchJob.prompt())
    {
        myBatchJob.run();
    }
}

If you want your batch job to have a description in the batch list, add a static description method to your class:

server client static public ClassDescription description()
{
    return "My batch job";
}
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!