Collecting AOT object Properties Details in to Excel

One of the user posted in DUG that he required the list of all Classes and its properties from AOT to extract into Excel..  So, here is my solution…..

static void Export_Classes_propertied(Args _args)
{
    SysExcelApplication xlsApplication;
    SysExcelWorkBooks xlsWorkBookCollection;
    SysExcelWorkBook xlsWorkBook;
    SysExcelWorkSheets xlsWorkSheetCollection;
    SysExcelWorkSheet xlsWorkSheet;
    SysExcelRange xlsRange;
    int row = 1;
    str fileName;
    TreeNode classesNode = TreeNode::findNode(@'\Classes');
    TreeNodeIterator iterator = ClassesNode.AOTiterator();
    TreeNode classNode = iterator.next();
    ClassName   className;
    UtilElements utilElements;
    System.DateTime CreatedSysDate, ModifiedDate;
    utcdatetime UtcCreatedDate, UtcModifiedDate;
    str StrCreatedDate, strModifiedDate;
    ;
    //Filename
    fileName = "C:\\Users\\saadullah\\Desktop\\Class.xlsx";  // Define your Excel Path


    //Initialize Excel instance
    xlsApplication = SysExcelApplication::construct();
    //Open Excel document
    //xlsApplication.visible(true);
    //Create Excel WorkBook and WorkSheet
    xlsWorkBookCollection = xlsApplication.workbooks();
    xlsWorkBook = xlsWorkBookCollection.add();
    xlsWorkSheetCollection = xlsWorkBook.worksheets();
    xlsWorkSheet = xlsWorkSheetCollection.itemFromNum(1);

    //Excel columns captions
    xlsWorkSheet.cells().item(row,1).value("ID");
    xlsWorkSheet.cells().item(row,2).value("Name");
    xlsWorkSheet.cells().item(row,3).value("Extends");
    xlsWorkSheet.cells().item(row,4).value("RunOn");
    xlsWorkSheet.cells().item(row,5).value("CreatedBy");
    xlsWorkSheet.cells().item(row,6).value("CreatedDateTime");
    xlsWorkSheet.cells().item(row,7).value("ChangedBy");
    xlsWorkSheet.cells().item(row,8).value("ChangedDateTime");
   
    row++;

    while (classNode)
    {
        className = classNode.treeNodeName();
        classNode.AOTgetProperties(true);
        select utilElements
            where utilElements.RecordType == UtilElementType::Class
            && utilElements.Name == className;
        UtcCreatedDate = utilElements.createdDateTime;
        CreatedSysDate = Global::utcDateTime2SystemDateTime(UtcCreatedDate);
        UtcCreatedDate = Global::CLRSystemDateTime2UtcDateTime(CreatedSysDate);
        StrCreatedDate = DateTimeUtil::toStr(UtcCreatedDate);
        UtcModifiedDate = utilElements.modifiedDateTime;
        ModifiedDate = Global::utcDateTime2SystemDateTime(UtcModifiedDate);
        UtcModifiedDate = Global::CLRSystemDateTime2UtcDateTime(ModifiedDate);
        strModifiedDate = DateTimeUtil::toStr(UtcCreatedDate);

        xlsWorkSheet.cells().item(row,1).value(classNode.applObjectId());
        xlsWorkSheet.cells().item(row,2).value(classNode.AOTgetProperty('Name'));
        xlsWorkSheet.cells().item(row,3).value(classNode.AOTgetProperty('Extends'));
        xlsWorkSheet.cells().item(row,4).value(classNode.AOTgetProperty('RunOn'));
        xlsWorkSheet.cells().item(row,5).value(utilElements.createdBy);
        xlsWorkSheet.cells().item(row,6).value(StrCreatedDate);
        xlsWorkSheet.cells().item(row,7).value(utilElements.modifiedBy);
        xlsWorkSheet.cells().item(row,8).value(strModifiedDate);
        classNode = iterator.next();
        
        row++;
    }

    //Check whether the document already exists
    if(WinApi::fileExists(fileName))
    WinApi::deleteFile(fileName);

    //Save Excel document
    xlsWorkbook.saveAs(fileName);
    xlsWorkbook.comObject().save();
    //Open Excel document
    xlsApplication.visible(true);

    //Close Excel
    //xlsApplication.quit();
    //xlsApplication.finalize();
}
Advertisements

Period is not Open

Hi Guys..

I have started with SCM , i have created one PO then im trying to do Packing Slip by filling the Packing Slip #, But it showing Period is not Open on my given Paking Slip Date.

the reason behind the error is there is no Fiscal Period for my packing Slip date.

So i have create Period in General Ledger->Setup->Periods->Periods

Problem solved….