Tag: Create by X++

Create Sale Order using AIF service AX2012 X++

SalesSalesOrderService will be required to place sales order. it is predefined service in AX2012. you will just need to perform following steps. 1-  Register Service (right click on service –>Add-In –>Register Service) and . 2-  System Administration –> Inbound ports –>{Add new salesorder service} On c# create salesorder like this. 3-  Create c# web service…

Create Purchase Order And Post Invoice via X++

Following is X++ code to create purchase order and post the invoice using PurchFormLetter class. static void CreatePOAndInvoice(Args _args) { PurchTable      purchTable; PurchLine       purchLine; VendTable       vendTable = VendTable::find(“1005”); AxPurchTable    axPurchTable; AxPurchLine     axPurchLine; PurchFormLetter purchFormLetter; //update site and warehouse locations. vendTable.InventSiteId =’DC’; vendTable.InventLocation = ‘TW’;…

D365FO | Ax2012: Create Counting Journal X++

public void CreateCountingJournal(JournalDescription _journalDescription, ItemId _itemId, InventQtyCounted _countedQuantity) { JournalCheckPost journalCheckPost; InventDim inventDim; InventDimParm tmpInventDimParm; InventJournalTrans journalTrans; InventJournalTable inventJournal; InventJournalName inventJournalName; JournalTableData journalTableData; InventSum inventSum; NumberSeq numberSeq; NumberSeq num; str journalName; str journalNum; int lineNum = 0; boolean errors; ; journalName = InventParameters::find().CountJournalNameId; num = new NumberSeq(); num = NumberSeq::newGetNum(InventParameters::numRefInventJournalId()); journalNum = num.num(); inventJournalName =…

D365FO: Create Counting Journal X++

public void CreateCountingJournal(JournalDescription _journalDescription, ItemId _itemId, InventQtyCounted _countedQuantity) { JournalCheckPost journalCheckPost; InventDim inventDim; InventDimParm tmpInventDimParm; InventJournalTrans journalTrans; InventJournalTable inventJournal; InventJournalName inventJournalName; JournalTableData journalTableData; InventSum inventSum; NumberSeq numberSeq; NumberSeq num; str journalName; str journalNum; int lineNum = 0; boolean errors; ; journalName = InventParameters::find().CountJournalNameId; num = new NumberSeq(); num = NumberSeq::newGetNum(InventParameters::numRefInventJournalId()); journalNum = num.num(); inventJournalName =…

AX 2012 | D365: Post Packing Slip using X++

static void postPackingSlip(Args _args) { SalesFormLetter salesFormLetter; SalesTable salesTable; SalesId salesId = ‘SO00001’; System.Exception error; str strError; CustPackingSlipJour custPackingSlipJour; ; ttsBegin; try { salesTable = SalesTable::find(salesId); if (salesTable && salesTable.SalesStatus == SalesStatus::Backorder) { salesFormLetter = SalesFormLetter::construct(DocumentStatus::PackingSlip); salesFormLetter.update(salesTable, systemDateGet(), SalesUpdate::PackingSlip, AccountOrder::None, NoYes::No, NoYes::No, NoYes::No); if (salesFormLetter.parmJournalRecord().TableId == tableNum(custPackingSlipJour)) { custPackingSlipJour = salesFormLetter.parmJournalRecord(); info(strFmt(‘New Packing Slip #:%1…

AX 2012 | D365: Post Sales Invoice using X++

static void postSalesInvoice(Args _args) { SalesFormLetter salesFormLetter; SalesTable salesTable; SalesId salesId = ‘005063’; System.Exception error; str strError; CustInvoiceJour custInvoiceJour; ; ttsBegin; try { salesTable = SalesTable::find(salesId); if (salesTable && salesTable.SalesStatus == SalesStatus::Delivered) { salesFormLetter = SalesFormLetter::construct(DocumentStatus::Invoice); salesFormLetter.update(salesTable, systemDateGet(), SalesUpdate::All, AccountOrder::None, NoYes::No, NoYes::No, NoYes::No, NoYes::Yes); if (salesFormLetter.parmJournalRecord().TableId == tableNum(CustInvoiceJour)) { custInvoiceJour = salesFormLetter.parmJournalRecord(); info(strFmt(‘Sales Order #:%1…