Saturday, 7 December 2013

AX2012 R2 : Understanding purchase requisition [Basics and X++code to create purchase requisitions]

Hi Friends,
In this post I would like to explain about:
  1. What is purchase requisition
  2. Why companies use purchase requisition
  3. Difference between purchase requisition and purchase order
  4. Technical dive in X++ code to create purchase requisition for a project.
What is Purchase Requisition:
  • Be very clear that a purchase requisition is an internal document for a company it is not a contract with the vendor to buy the goods.
  • It is raised by departments to notify the procurement department that they need to purchase some goods to fulfil the requirements.
  • This document has details like which items are required, how much quantity, for what purpose, and till which date the items are required.
  • There can be more details like from which vendor or for which business units that depends on each companies defined templates but the purpose is same.
  • An example is : A production department for a television  manufacturing company can raise a purchase requisition of 1000 panels to fulfil a production demand for the next month.
Why companies use Purchase Requisition:
  • The main goal is to authorize the procurement department to engage a vendor for a purchase commitment.
  • Another advantage is to have a better internal financial control.
  • Normally there are approvers who have the authority to approve the purchase requisition and send the approved requisition to the procurement department. These approvers can be someone from finance departments who work closely with the procurement team. In AX this is handled by workflow very well.
  • The purchase department should not change the details of purchase requisition without getting the approval.
  • Some companies have limits defined for example the procurement department can purchase orders worth maximum $3000 but if the amount is higher then it needs an approved purchase requisition.
Difference between Purchase requisition and Purchase orders:
  • Once a approved purchase requisition is received the procurement department has authority to engage a vendor to fulfil the requirements.
  • This agreement between a vendor and a company is known as Purchase Order.
  • It has details like the vendor name, address, delivery mode, delivery terms, mode of payment, item details, quantity, specification, taxes applicable, delivery dates, delivery schedule.
  • There can be much more complex information embedded in a purchase order like some trade agreement papers, freight provider information etc.
In Microsoft Dynamics AX 2012 R2 we can view Purchase requisition from Procurement and Sourcing --> Common --> Purchase requisition --> All Purchase Requisitions

User can also create new requisitions from this list page. Your user much be attached to a worker in the company otherwise the option to create a new requisition will be disabled.
Also the buying legal entity field will only show the lookup of companies where your user is mapped as a worker.

Then user can go ahead and add lines. There is a lot of information we can feed in AX purchase requisitions like buying legal entity, project for which the requisition is required, item, quantity, inventory dimensions, financial dimensions, procurement category, project activity which makes Dynamics AX a great rich application to do such processes :)

My aim here is not to show the complete function steps as there are many good references available
for doing the process, you can refer to the following links :
From here the blog takes a turn towards technical zone:)

I want to share some technical information regarding how we can create purchase requisition from X++ code for a project:
The purchase requisitions are store in  PurchReqTable and the lines are stored in PurchReqLine.
Both the tables are related in PurchReqId which is unique index in PurchReqTable as shown below:

The below job can be used to create a purchase requisition for an item requirement of a project.
We can link a purchase requisition line to a project item requirement.Which means we can define the project activity, procurement category, default vendor for the item, quantity and much more information on the purchase requisition line to have a great visibility of information.

The item requirements for a project are stored as sales lines. In case you do not have any link to project then also you can use the below job to create purchase requisitions by removing the project references from the code:

There are many more fields in PurchReqLine table which can be assigned if you have values to assign to them.

If you want to reuse the code, here it is:
 static void CreatePurchReqJob(Args _args)
    PurchReqTable   purchReqTable;
    PurchReqLine    purchReqLine;
    ProjTable       projTable = projTable::find("‪‪‪P000");
    SalesLine       salesLine = SalesLine::findInventTransId("TRANS-00001");
    purchReqTable.PurchReqId = NumberSeq::newGetNum(PurchReqTable::numRefPurchReqId()).num();
    purchReqTable.PurchReqName = "Testname";
    purchReqTable.ProjId = projTable.ProjId;
    purchReqTable.ProjIdDataArea = projTable.dataAreaId;
    purchReqLine.InventDimId = salesLine.InventDimId;
    purchReqLine.ItemId = salesLine.ItemId;
    purchReqLine.ActivityNumber = salesLine.ActivityNumber;
    purchReqLine.BuyingLegalEntity = CompanyInfo::find().RecId;
    purchReqLine.InventDimIdDataArea = salesLine.dataAreaId;


If you might have read closely then you must have noticed that numRefPurchReqId() method is available on PurchReqTable itself :)

The init methods on the table are quite helpful as they initialize number of fields for us so we do not need to worry unless we have some custom logic to initialize them.
So now that we have a basic understanding of purchase requisitions and how they are different from purchase orders with some pinch of technical flavour I hope this information will be helpful.

Thanks for reading the blog.



  1. Hi,

    I have some doubt regarding copy project creation in Project Management and Accounting.

    When i copy the specific project values, the item requirement values are missing in the standard.

    Original project has the item requirement values. But when copy project through wizard, it didn’t have the item requirement values stored to it.

    Needs to know the exact reason behind this issue. Or else how can i update the project item requirement values in copy project item requirements.

    Any idea on this, please share it.


  2. Replies
    1. Thanks for the feedback Josephat. Have a good day.