Hi Vignesh ,
There are multiple example available that create PO from X++ . You just use that peace of code and assign the variable from excel instead of hard code value .
You can try below link to create PO
ax2012xppdataimport.blogspot.com/.../microsoft-dynamics-ax-2012-xpp-purchase.html
For Excel import you can also find example..
static void InsertRecords(Args _args)
{
SysExcelApplication application;
SysExcelWorkbooks workbooks;
SysExcelWorkbook workbook;
SysExcelWorksheets worksheets;
SysExcelWorksheet worksheet;
SysExcelCells cells;
COMVariantType type;
Name name;
FileName filename;
int row =1;
int i=0;
InventTable inventTableLoc;
ItemId itemid;
TransDate transdate;
str NewField;
Dialog dialog;
DialogField dialogField;
;
application = SysExcelApplication::construct();
workbooks = application.workbooks();
dialog = new Dialog("FileOpen");
dialogfield = dialog.addField(extendedTypeStr(Filenameopen), "File Name");
dialog.run();
if (dialog.run())
{
filename = (dialogfield.value());
}
try
{
workbooks.open(filename);
}
catch (Exception::Error)
{
throw error("File cannot be opened.");
}
workbook = workbooks.item(1);
worksheets = workbook.worksheets();
worksheet = worksheets.itemFromNum(1);
cells = worksheet.cells();
do
{
ttsBegin;
row++;
itemid = cells.item(row, 1).value().bStr();
NewField = cells.item(row, 2).value().bStr();
inventTableLoc = InventTable::find(itemid,true);
inventTableLoc.NameAlias = NewField;
inventTableLoc.insert();
ttsCommit;
i++;
type = cells.item(row+1, 1).value().variantType();
}
while (type != COMVariantType::VT_EMPTY);
application.quit();
info("Done");
info(strFmt("%1", i));
}