web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Finance | Project Operations, Human Resources, ...
Suggested Answer

Exporting Vendor Master data using x ++ code

(0) ShareShare
ReportReport
Posted on by 3,110

Hi Experts,

There is any ready x++ code which can export all vendor data to excel sheet . 

Best Regards,

Shabir Ahmad

I have the same question (0)
  • Suggested answer
    mhdshb1 Profile Picture
    1,250 on at

    Hi Shabir,

    Do you really need to use x++ code to export ?

    You can use Data Import/Export Framework (DIXF) where you can export vendor data in a tabular format.

    Regards,

    M

  • Shabir Ahmad Profile Picture
    3,110 on at

    Hi Mohammad Al-Saheb,

    I wanted to use x++ job to export the vendor master data. I know DIXF is also good.

    Best Regards,

    Shabir Ahmad

  • Suggested answer
    mhdshb1 Profile Picture
    1,250 on at

    Hi Shabir, 

    Try this job it exports from VendTable.

    static void ExporttoExcel(Args _args)
    {
        SysExcelApplication              sysExcelApplication;
        SysExcelWorkbooks              excelWorkbookCollection;
        SysExcelWorkbook               excelWorkbook;
        SysExcelWorksheets             excelWorksheetCollection;
        SysExcelWorksheet              excelWorksheet;
        int                                          i =1;
        str                                          filename;
        vendTable                             vendTable;
        ;
    
    
        // give the file name and save it to c drive
         filename = "c:\\test.xls";
    
        // initlize the SysExcelApplication instance
        sysExcelApplication  = SysExcelApplication::construct();
    
        //create excel workbook and excel worksheet
        excelWorkbookCollection  = sysExcelApplication.workbooks();
        excelWorkbook    = excelWorkbookCollection.add();
        excelWorksheetCollection = excelWorkbook.worksheets();
        excelWorksheet = excelWorksheetCollection.itemFromNum(1);
    
        // excel column captions
    
        excelWorksheet.cells().item(i,1).value("AccountNumber");
        excelWorksheet.cells().item(i,2).value("AccountName");
        excelWorksheet.cells().item(i,3).value("VendorGroup");
        i  ;
        // fill the excel with vendtable Fields
        while select VendTable
        {
           excelWorksheet.cells().item(i,1).value(vendTable.AccountNum);
            excelWorksheet.cells().item(i,2).value(vendTable.name());
            excelWorksheet.cells().item(i,3).value(vendTable.VendGroup);
            i  ;
        }
    
        //check the fileName is already exist
         if(WinAPI::fileExists(filename))
             WinAPI::deleteFile(filename);
         // save excel file
         excelWorkbook.saveAs(filename);
    
        // open excel file
        sysExcelApplication.visible(true);
    
        // close excel file
     // sysExcelApplication.quit();
    
    }

    Hope this helps,

    Regards,

    M

  • Blue Wang Profile Picture
    on at

    Hi Shabir,

    You can use the SysExcel* class to export, try some published blog codes.

    Please refer this: imdaxershiv.blogspot.com/.../x-code-to-export-data-to-excel-sheet-in.html

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > Finance | Project Operations, Human Resources, AX, GP, SL

#1
Martin Dráb Profile Picture

Martin Dráb 592 Most Valuable Professional

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 478 Super User 2025 Season 2

#3
BillurSamdancioglu Profile Picture

BillurSamdancioglu 305 Most Valuable Professional

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans