class SPLPayDirectExcelImport extends runbase { SPLPayHeadDefination headDefination; ExcelimportADO excelimportADO; str 100 filename; str path; int i; Dialog filedialog; Dialogfield dialogFilename; #DEFINE.CurrentVersion(1) #LOCALMACRO.CurrentList filename #ENDMACRO } Object dialog() { //Object ret; filedialog = super(); filedialog.caption("Select File Name"); dialogFilename = filedialog.addField(extendedTypeStr(FileNameopen)) ; return filedialog; } public boolean getFromDialog() { ; filename = dialogFilename.value(); return true; } public container pack() { return [#CurrentVersion,#CurrentList] ; } public void run() { ; super(); excelimportADO = new Excelimportado(filename); excelimportADO. getExcelSheetNames(); excelimportADO.openFile(false) ; ttsbegin; while (!excelimportADO.eof()) { headDefination.HeadID = excelimportADO.getFieldValue( 1); headDefination.insert(); excelimportADO.moveNext(); i++; } info(strfmt('%1 No of records are imported ',i)); ttscommit; } public boolean unpack(container packedClass) { Integer _version = conPeek(packedClass,1); switch (_version) { case(#CurrentVersion) : [_version,#CurrentList] = packedClass; break; default : return false; } return true; } public static void main(Args args) { SPLPayDirectExcelImport ExcelImport; ExcelImport = new SPLPayDirectExcelImport(); if(ExcelImport.prompt()) { ExcelImport.run(); } }
This site contains some Microsoft Dynamics AX X++ Codes for use in your day to day use, as well future changes in Ax 2009, ax 2012 R2,R3 and RAINER (or) Ax 7, Workflow ,SSRS ,EP,AIF,DIXF
Tuesday, 24 December 2013
Direct Excel Import in ax 2012
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment