M3 Reference
PPS100
InteractivePurchase agreement maintenance — 'Purchase Agreement. Open', where supplier purchase agreements are created and maintained; the agreement file set is MPAGRH (header), MPAGRL (lines) and MPAGRP (prices), of which only MPAGRH is cataloged
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 PPS100 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: PPS100 — Purchase agreement maintenance — 'Purchase Agreement. Open', where supplier purchase agreements are created and maintained; the agreement file set is MPAGRH (header), MPAGRL (lines) and MPAGRP (prices), of which only MPAGRH is cataloged
-- Purpose: Read the tables behind program PPS100 — auto-generated from program-table-map
-- Grain : MPAGRH rows — the table's row grain is not verified (see its table page notes)
-- Tables : MPAGRH
-- 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
h.AHCONO AS "Company",
h.AHAGNB AS "Agreement number — the purchase agreement's identity",
h.AHSUNO AS "Supplier the agreement is held with — the join to CIDMAS"
FROM <catalog>.<schema>.MPAGRH h
WHERE
h.AHCONO = <company>
ORDER BY h.AHAGNB;