Skip to content

Sage 200 Online Purchase Order XML

Purchase orders are used to represent the purchase of goods or services from a supplier. They are central to a business and define the terms (price, quantity and times) by which the products or services will be bought. Further information can be found on the Sage 200 Online Purchase Order API Documentation.

Tasks

Identifiers

external_id

Optional (recommended)
To prevent duplicates purchase orders being imported into Sage 200 we would recommend to always set the external_id field to a unique id from the source system. When the field is provided it will be stored within Zynk's internal database along with the purchase order number assigned by Sage 200.

Type Example XML
string(255) 12345 <external_id>12345</external_id>

Fields for Download and Upload

supplier_id

Dependant (see supplier)
Supplier record Id, can also be set using supplier reference, see supplier.

Type Example XML
integer(int64) 27006 <customer_id>27006</customer_id>

document_no

Dependant
Purchase order document number. Note: If the POP setting in Sage 200 Extra is to NOT automatically generate numbers, then this property MUST be set. If the POP setting in Sage 200 Extra is to automatically generate numbers, or you are using Sage 200 Standard (which doesn't allow you to set this option), then this setting should not be provided.

Type Example XML
string(20) 12345 <document_no>12345</document_no>

document_date

Optional
Purchase order document date.

Type Example XML
datetime 2017-06-05T00:00:00 <document_date>2017-06-05T00:00:00</document_date>

supplier_document_no

Optional
Supplier document number.

Type Example XML
string(30) Order #12345 <supplier_document_no>Order #12345</supplier_document_no>

settlement_discount_days

Optional
Settlement discount days.

Type Example XML
integer(int16) 0 <settlement_discount_days>0</settlement_discount_days>

settlement_discount_percent

Optional
Settlement discount percent.

Type Example XML
number(decimal 2dp) 0.00 <settlement_discount_percent>0.00</settlement_discount_percent>

document_discount_percent

Optional
Document discount percent value, between -99.99 and 99.99. A negative value is treated as a surcharge (e.g. -10 is a 10% surcharge), and a positive value is treated as a discount.

Type Example XML
number(decimal 2dp) 0.00 <document_discount_percent>0.00</document_discount_percent>

requested_delivery_date

Optional
Requested delivery date.

Type Example XML
datetime 2017-06-10T00:00:00 <requested_delivery_date>2017-06-10T00:00:00</requested_delivery_date>

Analysis Codes

Optional
Analysis codes are only supported on POP Orders from version 2016.sp3 (12/09/2017). They are numbered from 1 to 5 (or 1 to 20 if you are using Sage 200 Professional), and can be specified in the XML using <analysis_code_X>, where X is the analysis code number.

Type Example XML
string(60) North <analysis_code_1>North</analysis_code_1>

lines

Optional
The purchase order lines collection. See Sage 200 Online Purchase Order Line XML for full details.

delivery_address

Optional
The purchase order delivery address. The <delivery_address> node is an object which contains the address fields, all of following fields must be inside the node, see full example XML below.

address_1

Optional
Address line 1.

Type Example XML
string(60) i6 <address_1>i6</address_1>

address_2

Optional
Address line 2.

Type Example XML
string(60) 6 - 8 Charlotte Square <address_2>6 - 8 Charlotte Square</address_2>

address_3

Optional
Address line 3.

Type Example XML
string(60) <address_3></address_3>

address_4

Optional Address line 4.

Type Example XML
string(60) <address_4></address_4>

city

Optional City.

Type Example XML
string(60) <city>Newcastle</city>

county

Optional
County.

Type Example XML
string(60) Tyne and Wear <county>Tyne and Wear</county>

postcode

Optional
Postcode.

Type Example XML
string(10) NE1 4XF <postcode>NE1 4XF</postcode>

address_country_code_id

Dependant (see address_country_code)
Country code Id, can also be set using country code, see address_country_code.

Type Example XML
integer(int64) 13 <address_country_code_id>13</address_country_code_id>

address_country_code

Dependant (see address_country_code_id)
The address country code. On a download all the related information of the address country code will be included in the XML, see Sage 200 Online Country Code XML. On an upload you can set the code of the country to use for the address and Zynk will lookup the correct internal id from Sage.

<address_country_code>
    <id>13</id>
    <date_time_updated>2015-10-30T22:33:16.67</date_time_updated>
    <name>Great Britain</name>
    <code>GB</code>
    <eu_member>true</eu_member>
</address_country_code>

Import example only setting the code

<address_country_code>
    <code>GB</code>
</address_country_code>

Fields for Download Only

id

Read Only
Purchase order record Id.

Type Example XML
integer(int64) 27766 <id>27766</id>

document_status

Read Only
Document status.

Type Example XML
string(20) EnumDocumentStatusLive <document_status>EnumDocumentStatusLive</document_status>

Available Values

  • EnumDocumentStatusLive,
  • EnumDocumentStatusOnHold
  • EnumDocumentStatusComplete
  • EnumDocumentStatusDispute
  • EnumDocumentStatusCancelled
  • EnumDocumentStatusDraft
  • EnumDocumentStatusPrinted
  • EnumDocumentStatusLost

authorisation_status

Read Only
Authorisation status.

Type Example XML
string(20) EnumPOPAuthorisationStatusNotRequired <authorisation_status>EnumPOPAuthorisationStatusNotRequired</authorisation_status>

Available Values

  • EnumPOPAuthorisationStatusNotRequired,
  • EnumPOPAuthorisationStatusNotAuthorised
  • EnumPOPAuthorisationStatusAuthorised
  • EnumPOPAuthorisationStatusQueried

exchange_rate

Read Only
Exchange rate.

Type Example XML
number(decimal 6dp) 1.0 <exchange_rate>1.0</exchange_rate>

subtotal_goods_value

Read Only
Goods value (sum of stock items and free text).

Type Example XML
number(decimal 2dp) 40.0 <subtotal_goods_value>40.0</subtotal_goods_value>

subtotal_charge_net_value

Read Only
Charge net value.

Type Example XML
number(decimal 2dp) 40.0 <subtotal_charge_net_value>40.0</subtotal_charge_net_value>

subtotal_discount_value

Read Only
Discount value.

Type Example XML
number(decimal 2dp) 40.0 <subtotal_discount_value>40.0</subtotal_discount_value>

subtotal_landed_costs_value

Read Only
Landed costs value.

Type Example XML
number(decimal 2dp) 40.0 <subtotal_landed_costs_value>40.0</subtotal_landed_costs_value>

total_net_value

Read Only
Net value (sum of all line types).

Type Example XML
number(decimal 2dp) 40.0 <total_net_value>40.0</total_net_value>

total_tax_value

Read Only
Tax value.

Type Example XML
number(decimal 2dp) 8.0 <total_tax_value>8.0</total_tax_value>

total_gross_value

Read Only
Gross value.

Type Example XML
number(decimal 2dp) 48.0 <total_gross_value>48.0</total_gross_value>

document_originator_name

Optional
Document originator name.

Type Example XML
string(30) John Smith <document_originator_name>John Smith</document_originator_name>

document_created_by_id

Optional
Document created by id.

Type Example XML
integer(int64) John Smith <document_created_by_id>1</document_created_by_id>

document_created_by

Optional
Document created by.

Type Example XML
string(30) John Smith <document_created_by>John Smith</document_created_by>

date_time_created

Read Only
The date and time this entity was created (UTC).

Type Example XML
datetime 2017-06-05T15:24:29.44 <date_time_created>2017-06-05T15:24:29.44</date_time_created>

date_time_updated

Read Only
The date and time this entity was last updated (UTC).

Type Example XML
datetime 2017-06-05T15:24:29.44 <date_time_updated>2017-06-05T15:24:29.44</date_time_updated>

Expandable Fields

Related information linked to purchase orders are also included in the downloaded XML, these can also be used to set certain fields on purchase order uploads using lookups rather than needing to know the internal id of the related record.

supplier

Dependant (see supplier_id)
The supplier order supplier. On a download all the related information of the supplier will be included in the XML, see Sage 200 Online Supplier XML. On an upload you can set the reference of the supplier to use for the purchase order and Zynk will lookup the correct internal id from Sage.

<supplier>
    <id>28986</id>
    <date_time_updated>2023-02-28T10:38:46.56Z</date_time_updated>
    <reference>WIS002</reference>
    <name>Wiseman Paper Products</name>
    <short_name>Wiseman</short_name>
    <balance>5868.13</balance>
    <on_hold>false</on_hold>
    <account_status_type>AccountStatusActive</account_status_type>
    <currency_id>2103</currency_id>
    <exchange_rate_type>ExchangeRateSingle</exchange_rate_type>
    <telephone_country_code>44</telephone_country_code>
    <telephone_area_code>0191</telephone_area_code>
    <telephone_subscriber_number>987 3897</telephone_subscriber_number>
    <fax_country_code>44</fax_country_code>
    <fax_area_code>0191</fax_area_code>
    <fax_subscriber_number>987 3899</fax_subscriber_number>
    <website>www.sage.co.uk</website>
    <credit_limit>10000.00</credit_limit>
    <country_code_id>13</country_code_id>
    <default_tax_code_id>1729</default_tax_code_id>
    <vat_number>GB974 3945 34</vat_number>
    <account_type>TradingAccountTypeOpenItem</account_type>
    <early_settlement_discount_percent>2.50</early_settlement_discount_percent>
    <early_settlement_discount_days>30</early_settlement_discount_days>
    <payment_terms_days>30</payment_terms_days>
    <payment_terms_basis>PaymentDueFromDocumentDate</payment_terms_basis>
    <terms_agreed>true</terms_agreed>
    <credit_bureau_id>2135</credit_bureau_id>
    <credit_position_id>1</credit_position_id>
    <trading_terms>30 Days Strictly Net</trading_terms>
    <credit_reference />
    <account_opened>2018-03-28T00:00:00Z</account_opened>
    <last_credit_review xsi:nil="true" />
    <next_credit_review xsi:nil="true" />
    <application_date xsi:nil="true" />
    <date_received xsi:nil="true" />
    <order_priority />
    <months_to_keep_transactions>36</months_to_keep_transactions>
    <default_nominal_code_reference>5000</default_nominal_code_reference>
    <default_nominal_code_cost_centre />
    <default_nominal_code_department />
    <analysis_code_1>North East</analysis_code_1>
    <analysis_code_2>Paper Supplies</analysis_code_2>
    <analysis_code_3 />
    <analysis_code_4 />
    <analysis_code_5 />
    <analysis_code_6 />
    <analysis_code_7 />
    <analysis_code_8 />
    <analysis_code_9 />
    <analysis_code_10 />
    <analysis_code_11 />
    <analysis_code_12 />
    <analysis_code_13 />
    <analysis_code_14 />
    <analysis_code_15 />
    <analysis_code_16 />
    <analysis_code_17 />
    <analysis_code_18 />
    <analysis_code_19 />
    <analysis_code_20 />
    <value_of_current_orders_in_pop>13481.78</value_of_current_orders_in_pop>
    <is_supplier_payments_enabled>false</is_supplier_payments_enabled>
</supplier>

Import example only setting the reference

<supplier>
    <reference>WIS002</reference>
</supplier>

Example XML

Minimal Example

<?xml version="1.0" encoding="utf-8"?>
<PurchaseOrders
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xmlns:xsd="http://www.w3.org/2001/XMLSchema">
    <PurchaseOrder>
        <supplier>
            <reference>WIS002</reference>
        </supplier>
        <lines>
            <line>
                <line_quantity>1</line_quantity>
                <product>
                    <code>TEST001</code>
                </product>
            </line>
        </lines>
    </PurchaseOrder>
</PurchaseOrders>

Full Example

<?xml version="1.0" encoding="utf-8"?>
<PurchaseOrders
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xmlns:xsd="http://www.w3.org/2001/XMLSchema">
    <PurchaseOrders>
        <id>27766</id>
        <external_id>12345</external_id>
        <supplier_id>27006</supplier_id>
        <document_no>12345</document_no>
        <document_date>2017-06-05T00:00:00</document_date>
        <supplier_document_no>Order #12345</supplier_document_no>
        <settlement_discount_days>0</settlement_discount_days>
        <settlement_discount_percent>0.00</settlement_discount_percent>
        <requested_delivery_date>2017-06-10T00:00:00</requested_delivery_date>
        <supplier>
            <reference>WIS002</reference>
        </supplier>
        <delivery_address>
            <address_1>i6</address_1>
            <address_2>6 - 8 Charlotte Square</address_2>
            <address_3 />
            <address_4 />
            <city>Newcastle</city>
            <county>Tyne and Wear</county>
            <postcode>NE1 4XF</postcode>
            <address_country_code>
                <code>GB</code>
            </address_country_code>
        </delivery_address>
        <analysis_code_1>North</analysis_code_1>
        <analysis_code_2>Software</analysis_code_2>
        <analysis_code_3>01/01/2005</analysis_code_3>
        <analysis_code_4>10</analysis_code_4>
        <analysis_code_5>true</analysis_code_5>
        <lines>
            <line>
                <line_type>EnumLineTypeStandard</line_type>
                <description>Test Product</description>
                <line_quantity>4.0</line_quantity>
                <selling_unit_price>10.0</selling_unit_price>
                <unit_discount_percent>0.0</unit_discount_percent>
                <unit_discount_value>0.0</unit_discount_value>
                <show_on_supplier_docs>true</show_on_supplier_docs>
                <product>
                    <code>TEST001</code>
                </product>
                <tax_code>
                    <code>1</code>
                </tax_code>
            </line>
        </lines>
    </PurchaseOrders>
</PurchaseOrders>