How to Import Records from Excel Using X++ Code in D365FO

  How to Import Records from Excel Using X++ Code in D365FO   Include the below namespace in X++ code it will requires to import Excel. Using System.IO; Using OfficeOpenXml; Using OfficeOpenXml.ExcelPackage; Using OfficeOpenXml.ExcelRange;   In addition to the basic reference, include (Directory and DirectoryUpgrade Packages) X++ Code: Using System.IO; Using OfficeOpenXml; Using OfficeOpenXml.ExcelPackage; Using OfficeOpenXml.ExcelRange; class ReadExcel {   public static void main(Args _args)    {     Int id;     Str Name;      System.IO.Stream stream;       ExcelSpreadsheetName sheet;              FileUploadBuild fileUpload,fileUploadBuild;       DialogGroup dialogUploadGroup;       FormBuildControl formBuildControl;       Dialog dialog=new Dialog("Excel Import using dialog");       dialogUploadGroup=dialog.addGroup("@SYS54759");       formBuildControl=dialog.formBuildDesign().control(dialogUploadGroup.name());    

Create production order in D365FO X++

 Create production order in D365FO  X++

static void   CreateProdOrder(Args _args)

{

    ProdQty         qty     = 10;

    ItemId          item    = 'D0005';

 

    ProdTable       prodtable;

    InventTable     inventTable;

    InventDim       inventDim;

    ;

 

    // Initialize InventTable

    inventTable = inventTable::find(item);

 

    // Initialize the base values

    prodtable.initValue();

    prodtable.initFromInventTable(inventTable);

 

    prodtable.ItemId                = inventTable.ItemId;

    prodtable.DlvDate               = today();

    prodtable.QtySched              = qty;

    prodtable.RemainInventPhysical  = qty;

 

    inventDim.initValue();

 

    // Set the active BOM and Route

    prodtable.BOMId = BOMVersion::findActive(prodtable.ItemId,

                                             prodtable.BOMDate,

                                             prodtable.QtySched,

                                             inventDim).BOMId;

 

    prodtable.RouteId = RouteVersion::findActive(prodtable.ItemId,

                                                 prodtable.BOMDate,

                                                 prodtable.QtySched,

                                                 inventDim).RouteId;

 

    // Initialize BOMVersion

    prodtable.initBOMVersion();

    // Initialize RouteVersion

    prodtable.initRouteVersion();

 

    //Use ProdTableType class to create the production order

    prodtable.type().insert();

 

    // Inform Production Order Id

        info(prodtable.ProdId);

}

Comments

Popular posts from this blog

D365 FO: REFRESH CALLER FORM DATA SOURCE FROM A CLASS X++

Customize SSRS report using extension in D365FO

CREATE AND POSTING PURCHASE ORDER THROUGH X++ DYNAMICS AX