Purchase order creation in Ax 2012 using x++
Declaration
NumberSeq numberSeq;
PurchTable purchTable;
PurchLine purchLine;
Getting Number sequence
numberSeq = NumberSeq::newGetNum(PurchParameters::numRefPurchId());
numberSeq.used();
purchTable.PurchId = numberSeq.num();
Find the vendor account
purchTable.initFromVendTable(VendTable::find('US-101'));
Validation
if (!purchTable.validateWrite())
{
throw Exception::Error;
}
Adding line item and details
purchLine.PurchId = purchTable.PurchId;
purchLine.ItemId = '1000';
Create line details and checking validation
purchLine.createLine(true, true, true, true, true, true);
Code
Creating open purchase order
static void PurchaseOrderCreation(Args _args)
{
NumberSeq numberSeq;
PurchTable purchTable;
PurchLine purchLine;
;
ttsBegin;
// geting number sequence
numberSeq = NumberSeq::newGetNum(PurchParameters::numRefPurchId());
numberSeq.used();
// Asign purch id
purchTable.PurchId = numberSeq.num();
// calling table initvalue method
purchTable.initValue();
// find the vendor account
purchTable.initFromVendTable(VendTable::find('US-101'));
// validation
if (!purchTable.validateWrite())
{
throw Exception::Error;
}
// insert data
purchTable.insert();
purchLine.PurchId = purchTable.PurchId;
purchLine.ItemId = '1000';
// Purch line creation
purchLine.createLine(true, true, true, true, true, true);
ttsCommit;
info(strFmt("Purchase order '%1' has been created",purchTable.PurchId));
}
How to data insert WITHHOLDING TAX table ON A PURCHASE ORDER – X++
ReplyDeleteHow to data insert WITHHOLDING TAX table ON A PURCHASE ORDER – X++..Please send me technical coding
ReplyDelete