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());    

X++ Create Purchase order from Sales order in D365 FO

 X++ Create Purchase order from Sales order in D365 FO


TmpPurchLinePrice tmpPurchLinePrice;

PurchCreateFromSalesOrder PurchCreateFromSalesOrder;

SalesTable salesTable;

;

salesTable = salesTable::find(“SO0000009”);

tmpPurchLinePrice.clear();

tmpPurchLinePrice.initValue();

tmpPurchLinePrice.Included = NoYes::Yes;

tmpPurchLinePrice.LineAmount = 100;

tmpPurchLinePrice.PurchUnit = “EA”;

tmpPurchLinePrice.PriceUnit = 12;

tmpPurchLinePrice.CurrencyCode = “USD”;

tmpPurchLinePrice.ItemId = “0001882”;

tmpPurchLinePrice.PurchQty = 2;

tmpPurchLinePrice.AccountNum = “V000002“;

tmpPurchLinePrice.SalesId = “SO0000009”;

tmpPurchLinePrice.SalesLineRefRecId = 5637146077;

tmpPurchLinePrice.LineNum = 2;

 

if (tmpPurchLinePrice.validateWrite())

{

tmpPurchLinePrice.insert();

}

 

// Now create the Purchase Order

purchCreateFromSalesOrder = PurchCreateFromSalesOrder::construct();

purchCreateFromSalesOrder.parmCallerRecord(salesTable);

purchCreateFromSalesOrder.parmTmpPurchLinePrice(tmpPurchLinePrice);

 

purchCreateFromSalesOrder.parmSalesTable(salesTable);

purchCreateFromSalesOrder.tradeLineDlvType(tradeLineDlvType::None);

purchCreateFromSalesOrder.run();

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