Created
June 2, 2021 20:11
-
-
Save omarmurcia/a73ddd0895bb715a5503f7a46a3df7b0 to your computer and use it in GitHub Desktop.
Create PO and PO's Line - D365
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void clicked() | |
{ | |
PurchTable purchTable; | |
PurchLine purchLine; | |
InventDim inventDim; | |
NumberSeq numberSeq; | |
//add by fanddy | |
AxPurchTable axPurchTable; | |
AxPurchLine axPurchLine; | |
PurchFormLetter purchformLetter; | |
//END | |
//create PO Header | |
purchTable.clear(); | |
purchTable.initFromVendTable(VendTable::find(TECPOGroupHeader.VendAccount)); | |
purchTable.DefaultDimension = InventTable::find(POGroupLine.ItemId).DefaultDimension; | |
axPurchTable = axPurchTable::newPurchTable(purchTable); | |
axPurchTable.parmPurchId(NumberSeq::newGetNum(PurchParameters::numRefPurchId()).num()); | |
axPurchTable.parmPurchaseType(PurchaseType::Purch); | |
axPurchTable.parmDocumentStatus(DocumentStatus::PurchaseOrder); | |
axPurchTable.parmAccountingDate(systemDateGet()); | |
axPurchTable.parmDeliveryDate(systemDateGet()); | |
axPurchTable.parmPurchStatus(PurchStatus::Backorder); | |
axPurchTable.save(); | |
info(strFmt('Create PO %1', Purchtable.PurchId)); | |
//create PO Line | |
purchLine.clear(); | |
purchLine.initValue(); | |
purchLine.initFromPurchTable(purchTable); | |
purchLine.initFromInventTable(InventTable::find(POGroupLine2.ItemId)); | |
axPurchLine = AxPurchLine::newPurchLine(purchLine); | |
axpurchLine.parmItemId('YOUR ITEMID'); | |
axPurchLine.parmPurchQty(YOUR QTY); | |
axPurchLine.parmPurchPrice(YOUR PRICE); | |
axPurchLine.parmInventDimId('YOUR INVENTDIMID'); | |
axPurchLine.save(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment