Auto-coding rules for Purchase Orders

This article applies to Ramp Administrators with procurement permissions. You must have the Procurement product enabled and an accounting provider connected.

Overview

Ramp's accounting rules can automatically populate accounting fields on Purchase Orders, reducing manual coding work for your AP team. Previously available only for card transactions and expenses, auto-coding rules now support Purchase Orders as an expense type.

Auto-coding rules run when:

Purchase Order auto-coding uses the same accounting rules system as transactions and expenses. For a full overview of rule types and the accounting rules hierarchy, see Managing Accounting Rules.

Access auto-coding rules

You can access auto-coding rules from the Purchase Order settings or directly from the accounting rules page.

From purchase order settings

  1. Go to Procurement > Purchase Orders > Settings .
  2. Select the Automation tab.
  3. Under Autocoding , click Coding rules . This opens the accounting rules drawer.

From accounting settings

  1. Go to Settings > Accounting .
  2. Open Coding Rules . Rules created here with the Expense type is Purchase Order condition apply to POs.

Create an advanced rule for purchase orders

Advanced rules use if/then logic to code Purchase Orders based on conditions you define. Use an advanced rule when you want to target Purchase Orders specifically.

  1. In the accounting rules drawer, select Advanced rules and click Create rule .
  2. In the If the following conditions are met step, add the condition: Expense type is Purchase Order . You can add additional conditions such as amount, department, or employee.
  3. In the Then code to the following fields step, choose an action type:
  1. Name the rule and click Save .

On save, Ramp executes the rule against all eligible Purchase Orders and applies it automatically when new Spend Requests are created or updated.

Simple rules

Simple (mapping) rules create a direct link between a Ramp field and an accounting field. For example, you can map a Ramp Category to a specific GL Account. Simple rules apply across all expense types, including Purchase Orders, when the mapped field values match.

  1. In the accounting rules drawer, select Simple rules and click Create rule .
  2. Select the Ramp field to match on (such as Category, Merchant, Department, or Location).
  3. Select the accounting field to set (such as GL Account, Department, or Class).
  4. Map the values and click Save .

Note: Simple rules are not limited to Purchase Orders. They apply to any matching expense type. For PO-specific rules, use an advanced rule with the Expense type is Purchase Order condition.

How auto-coding appears on purchase orders

When an accounting field on a Purchase Order has been set by a rule, Ramp displays a lightning bolt icon next to the field with a tooltip indicating the source:

Click Edit rule from the field to open the rule that applied the value.

If you manually set an accounting field value on a Purchase Order, auto-coding rules do not overwrite it. Manual selections are always preserved.

Permissions

Frequently asked questions

Do auto-coding rules apply to existing Purchase Orders?

When you save a new advanced rule with the condition Expense type is Purchase Order, Ramp executes it against all eligible existing Purchase Orders. Rules also run automatically when new Spend Requests are created or updated.

Can I use simple rules for Purchase Orders?

Yes. Simple (mapping) rules apply across all expense types, including Purchase Orders, when the mapped Ramp field values match. For targeted PO-only rules, use an advanced rule with the Expense type is Purchase Order condition.

Which accounting fields can be auto-coded?

The available accounting fields depend on your connected accounting provider. Common fields include GL Account, Department, Class, Location, and Inventory Item.

Do auto-coding rules overwrite values I set manually?

No. If you manually set an accounting field value on a Purchase Order, auto-coding rules preserve your selection and do not overwrite it.

Are all Purchase Orders eligible for auto-coding?

Auto-coding applies to Purchase Orders created in Ramp or through the Developer API. Draft POs and POs imported from your ERP are excluded from auto-coding.

Can I see which rule coded a Purchase Order?

Yes. Fields coded by a rule display a lightning bolt icon with a tooltip showing the source (mapping rule, advanced rule, or default value). Click Edit rule to open the rule directly.