M3 Reference
PPS220
InteractivePurchase order line display — line-level review and mass change across the MPLINE lines of the MPHEAD orders
Tables vs APIs
This program works over the tables below. For analytics at scale, land the raw tables — the SQL further down reads them directly, joined on their keys and CONO. When to land tables vs call MI APIs
Boilerplate SQL
Databricks SQLStarting point for reading the tables behind PPS220 from landed data — the backing tables joined on their keys and CONO. Set your Unity Catalog location, company, and filter values below.
Query parameters
3 parameters not filled: <catalog>, <schema>, <company>
-- ============================================================
-- Program: PPS220 — Purchase order line display — line-level review and mass change across the MPLINE lines of the MPHEAD orders
-- Purpose: Read the tables behind program PPS220 — auto-generated from program-table-map
-- Grain : MPLINE × MPHEAD — 1:N joins yield one row per line
-- Tables : MPLINE, MPHEAD
-- Notes : Auto-generated skeleton for a prefixed physical M3 schema or a landing schema normalized to the prefixed names in this catalog. Raw Data Lake property names vary with the published object: map them through Data Catalog before running this SQL. Dates are numeric YYYYMMDD (0 = none, mapped to NULL); all curated status values are decoded inline; company-partitioned tables are joined on CONO to prevent cross-company fan-out. Audit columns (RGDT/RGTM/LMDT/CHNO/CHID) omitted — see the quirks guide.
-- ============================================================
SELECT
pl.IBCONO AS "Company",
pl.IBPUNO AS "Purchase order number",
pl.IBPNLI AS "Purchase order line number",
pl.IBPNLS AS "Line subnumber — subdivides a line across deliveries",
CASE pl.IBPUSL WHEN '12' THEN 'Awaiting authorization' WHEN '15' THEN 'Entered — ready for printout' WHEN '20' THEN 'Document printed' WHEN '50' THEN 'Goods received' WHEN '60' THEN 'Quality inspection partially performed' WHEN '64' THEN 'Rejected at inspection — handling not yet decided' WHEN '65' THEN 'Quality inspection completed' WHEN '69' THEN 'Rejected at inspection — handled through the claim routine' WHEN '70' THEN 'Put-away partially completed' WHEN '75' THEN 'Put-away complete' ELSE pl.IBPUSL END AS "Lowest line status — the least-processed point any part of the line's quantity still sits at; the line is fully received only when this end reaches the receipt rungs", -- status: PUST_LINE (all 10 curated values)
CASE pl.IBPUST WHEN '12' THEN 'Awaiting authorization' WHEN '15' THEN 'Entered — ready for printout' WHEN '20' THEN 'Document printed' WHEN '50' THEN 'Goods received' WHEN '60' THEN 'Quality inspection partially performed' WHEN '64' THEN 'Rejected at inspection — handling not yet decided' WHEN '65' THEN 'Quality inspection completed' WHEN '69' THEN 'Rejected at inspection — handled through the claim routine' WHEN '70' THEN 'Put-away partially completed' WHEN '75' THEN 'Put-away complete' ELSE pl.IBPUST END AS "Highest line status — the furthest point any part of the line's quantity has reached; on a partially received line this reads ahead of the quantity still outstanding", -- status: PUST_LINE (all 10 curated values)
ph.IAPUSL AS "Lowest line status on the order", -- status: decode ph.IAPUSL against your configuration — see quirks guide #statuses
ph.IAPUST AS "Highest line status on the order" -- status: decode ph.IAPUST against your configuration — see quirks guide #statuses
FROM <catalog>.<schema>.MPLINE pl
LEFT JOIN <catalog>.<schema>.MPHEAD ph
ON ph.IAPUNO = pl.IBPUNO
AND ph.IACONO = pl.IBCONO
WHERE
pl.IBCONO = <company>
ORDER BY pl.IBPUNO;Backing Tables
How these tables connect — join details in the list below.