Tuesday, November 16, 2010

Creating Purchase Orders Through code in ax 2009

You can create Purchase Orders through code by using AxPurchTable and AxPurchLine Classes

static void createPurchOrder(Args _args)
{
AxPurchLine axPurchLine = new axPurchLine();
AxPurchTable axPurchTable = new axPurchTable();
;
axPurchTable.parmPurchId();///Creates new PurchId
axPurchTable.parmOrderAccount('1001');///Vendor Account
axPurchTable.save();

axPurchLine.parmPurchId(axPurchTable.parmPurchId());////Assigns PurchId
axPurchLine.parmItemId('PolyEthylene');///Item Number
axPurchLine.axInventDim().parmInventSiteId("Unit1");///Site Id
axPurchLine.axInventDim().parmInventLocationId("RM");/// Warehouse
axPurchLine.parmPurchQty(1000);///Quantity
axPurchLine.parmPurchPrice(20);///Purchase price per one quantity
axPurchLine.save();
}

No comments:

Post a Comment