Create and submit a Purchase Requisition
Purchase requisition is a step in the purchasing workflow that provides a way to accept, track and authorize purchasing requests from any internal department. Once approved, a requisition is an internal document that authorizes the purchasing department to buy items or services.
Also, the approved purchase requisition can be used to create the purchase order in the system. Purchase orders are the external documents that the purchasing department submits to vendors.
Scenario
In this blog post we will create a purchase requisition for vendor US-111 and the item we will be requisitioning will be C0003. We will use the D365 Contoso environment (with USMF legal entity).
How to Create and Submit a Purchase Requisition: Dynamics 365 Functional Walkthrough
Step 1
Open the D365 FO application in the browser and click on the button in the top left corner. From the displayed list click on Modules to further expand the list, then click on Procurement and Sourcing.
Step 2
From the newly–displayed list parallel to the modules list, open Purchase requisitions and then click All purchase requisitions.
Step 3
In the All purchase requisitions form, all existing purchase requisitions are displayed in the grid. To create a new purchase requisition, click on the + New button in the top left corner of the form.
Step 4
The ‘Create purchase requisition’ form will appear on the right side of the window.
Step 5
As you can see, the Purchase requisition number is auto-generated – this will happen only if a number sequence for purchase requisition is configured. Enter any meaningful name for the purchase requisition, and click OK at the bottom of the form.
Step 6
After clicking the OK button, the newly-created requisition is opened in a typical Dynamics 365 transaction form, with Header and Lines sections. Notice that the current status of our new purchase requisition header record is Draft.
Step 7
In the Purchase requisition header, select a value from the Reason drop-down in the Business Justification field group.
Step 8
Now we want to work with the Lines section. Click on the caret (as highlighted below) to collapse the Purchase requisition header area to bring this data into view.
Step 9
In the Purchase requisition lines section, click on the + Add line button to drop new detail line into the grid.
Step 10
When the new line is created, some of the values will be pre-filled with default values, such as the –Requester and the Buying legal entity. Click inside the Item number field to select an item to requisition for purchase. A number of default values for that item will be brought into the detail record.
Step 11
Now click on Save in the toolbar.
Step 12
We have created our requisition; in the next step, click on WorkFlow in the toolbar, then select Submit.
Step 13
The Purchase requisition review – Submit form appears next. You can optionally enter comments about the requisition here. Click Submit to submit your requisition for approval.
Step 14
After submitting for approval, the purchase requisition status will be changed from Draft to In review.
How to Create and Submit a Purchase Requisition: Dynamics 365 Technical Overview
Now let’s have a look at the components of the Dynamics 365 data model behind these transactions.
Entity Relationship Diagram (ERD)
Here is the Runnable class(job), which will create a purchase requisition.
[sourcecode language=”c-sharp”] class ibCreatePurchRequisition{
/// <summary>
/// Runs the class with the specified arguments.
/// </summary>
/// <param name = "_args">The specified arguments.</param>
public static void main(Args _args)
{
ItemId itemId;
PurchReqTable purchReqTable;
PurchReqLine purchReqLine;
InventTable inventTable;
itemId = "A0001"; //Replace ItemId here according to your system’s data
inventTable = InventTable::find(itemId);
//Validation if Item Id exists
if(!inventTable)
{
throw error(strFmt("The item id does not exist."));
}
ttsbegin;
//Purchase requisition header
purchReqTable.clear();
purchReqTable.initValue();
purchReqTable.PurchReqId = NumberSeq::newGetNum(PurchReqTable::numRefPurchReqId()).num();
purchReqTable.PurchReqName = ‘ibPR from Runnable Job’;
purchReqTable.insert();
//Purchase requisition lines
purchReqLine.clear();
purchReqLine.initValue();
purchReqLine.initFromPurchReqTable(purchReqTable);
purchReqLine.ItemId = itemId;
purchReqLine.BuyingLegalEntity = CompanyInfo::find().RecId;
purchReqLine.InventDimIdDataArea = curext();
purchReqLine.PurchQty = 2;
purchReqLine.modifiedField(fieldNum(purchReqLine,ItemId));
purchReqLine.insert();
ttscommit;
info(strFmt("Purchase requisition ‘%1’ created successfully",purchReqTable.PurchReqId));
}
}
[/sourcecode]
PurchReqTable:
PurchReqTable serves as the header table for purchase requisitions; here header-level data items like Purchase requisition Ids, Name, business justification code and status are saved.
This table alone can be the basis for many useful reports, e.g.:
- Purchase requisitions by status (i.e. Submitted, In review or Approved).
- Purchase requisitions created within a specific time period.
- Purchase requisitions submitted by specific user.
Field | Data Type | Description |
PurchReqId | String | Unique identifier for a requisition |
BusinessJustification | Int64 | Enum for a reason value (e.g. 0-General, 1-Renovation, 2-Specific) |
RequisitionStatus | Enum | Enum code for a status value (e.g. 0-Draft, 1-In review) |
PurchReqName | String | Optional meaningful nickname entered by requesting user |
PurchReqType | Enum | Requisition type i.e. General purchase saved here. |
SubmittedBy | String | Requesting user name |
PurchReqLine:
This table serves as the details table in the purchase requisition creation process. Some reports that can be drawn from this table include:
- Purchase Price trend by item and vendor
- Total number of purchase orders created from requisitions
- Purchase requisition details by vendor
Field | Data Type | Description |
ItemId | string | Item ID of the item being requisitioned in this line |
PurchReqId | Int64 | Associated purchase requisition number/id |
InventLocationId | string | Inventory location for this requisition line |
Requisitioner | Int64 | Requesting user id, link to the HCMWorker table |
VendorAccount | String | Vendor ID to source the item requested in this line, link to VendTable |
PurchId | String | Purchase order id created from this line after approval |
VendTable:
In D365, this table is used to store information about vendor accounts. This table has relations with other tables for multiple operations. In the report development, this table is mostly used as a supporting table. Some major fields of this table are mentioned below. For more details and queries about this table, please follow this link.
<tableclass=”table-blog-post” data-tablestyle=”MsoTableGrid” data-tablelook=”1184″>
Field Data Type Description AccountNum string Unique number assigned to each vendor record Party Int64 Referenced recid of the DirPartyTable record for this vendor InventSiteId string Inventory site attached to vendor record
PurchTable:
In the process of purchase requisition creation, PurchTable is used when a user creates a purchase order from approved purchase requisitions. In this table the system stores information of Purchase orders. This table is also important to create reports for Procurement and Sourcing.
All purchase orders are created against specific purchase requisition numbers.
For more information about the table, please follow this link.
Field | Data Type | Description |
PurchId | string | Unique number assigned to each purchase order record |
OrderAccount | string | Vendor account for which purchase order created |
InventSiteId | string | Inventory site attached to purchase order record |
InventTable:
This is an inventory table, and it saves information about all the released items. Almost all inventory processes use this table to select items. This table has a relation with EcoResProduct table to get the corresponding product number related to the item. Some major fields of this table are mentioned below.
For more information about InventTable please follow this link.
Field | Data Type | Description |
ItemId | string | Unique number assigned to each item record |
ItemType | enum | Item type i.e Item or service saved here |
NameAlias | string | Full name of item |
Product | Int64 | Referenced recId of EcoResProduct table |
Conclusion
In this blog post we have discussed about Purchase requisition creation process. We created a purchase requisition for item number C0001 and used USMF as legal entity. After creation we submitted that purchase requisition. In second part we overviewed technical side of the purchase order creation process. As we came to know that header info of purchase requisition saved in PurchReqTable and lines details are saved in PurchReqLine table.
Things have changed a lot since I started blogging over a decade ago. There are so many wonderful topics to blog and learn on today; it seems like one doesn’t even know where to start. To make the process more friendly, I’ve introduced a new sort of post — the hybrid video/blog tutorial. In this series, we will produce a video and blog for every topic covered. Some very talented developers from my team have contributed their expertise to assist with this content/video approach to ensure that we keep our quality and quantity high. I hope you all sincerely enjoy the new approaches that we’ve innovated.. And as always, don’t hesitate to reach out to me.. I’m always here to help. – Brandon Ahmad
We sincerely hope that you enjoyed part 6 of our exciting series on the Dynamics 365 data model. We aim to provide quality service at all times. And as always, if you need to reach me, you know how to get in touch by reaching out to me here. — Brandon Ahmad, founder of InstructorBrandon and Dynatuners
Hey I know this is off topic but I was wondering if
you knew of any widgets I could add to my blog that automatically tweet my
newest twitter updates. I’ve been looking for a plug-in like this for quite some time and
was hoping maybe you would have some experience with something like this.
Please let me know if you run into anything. I truly enjoy reading your blog and I look forward
to your new updates.