Import Csv file to Ax 2012 using X++ code and as Runbase batch

class John_RBTestClass extends RunBaseBatch

client server static ClassDescription description()
return “Johnkrish Batch Test”;

static void main(Args _args)
John_RBTestClass objClass = new John_RBTestClass();
//prompt for runbase framework dialog
if (objClass.prompt())
//run the process;


public void run()
Bill_Copy bc;

IO iO;
CustAccount custAccount;
CustName custname;
str one;
FilenameOpen filename = @’E:\Johnkrish\Johnkrish.csv’;//To assign file name
Container record;
boolean first = true;

str Delimiter = “,”;
int totalRecords;
iO = new CommaTextIo(filename,#IO_Read);
if (! iO || iO.status() != IO_Status::Ok)
throw error(“@SYS19358”);

record =;

while(iO.status() == IO_Status::Ok)


record =;


bc.CustName=conpeek(record, 1);
bc.ItemName=conpeek(record, 2);



DATA in .Csv file


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s