From: http://blog.ak-home.net/CategoryView,category,Dynamics%2BAx%2cProgrammierung%2cAPI.aspx
A purchase order in AX is always a record of table "PurchTable", if this order contains an item, related records exists in table "PurchLine". In addition, depending on the data or the order, additional records exist in other tables.
The logic that controls the creation or individual purchase record is displayed in AX through the classes "PurchTableType", "PurchLineType" and their derived classes. These classes control the behavior of invenstment, change and cancellation of an order.
These classes are called from the overridden methods of table "PurchTable" and "PurchLien". These methods include "insert", "update", "delete", "validateField",and so on.
The creation of an order is as easy as creating a sales order:
1. A new reference number of the number sequence can be drawn.
2. The method "initValue" of table "PurchTable" must be called.
3. The method "initFromVendTable" of table "PurchTable" must be called.
4. The method "insert" of table "PurchTable" must be called.
If this purchase order has articles, insert articels by calling method "CreateLine" of table "PurchLine" with the prior definition of the purchase order number("PurchLine.PurchId") and article("PurchLine.ItemId").
For example: