M3 Reference
OIS100
InteractiveCustomer order entry — creates and maintains customer orders, writing the OOHEAD/OOLINE pair
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 OIS100 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: OIS100 — Customer order entry — creates and maintains customer orders, writing the OOHEAD/OOLINE pair
-- Purpose: Read the tables behind program OIS100 — auto-generated from program-table-map
-- Grain : OOHEAD × OOLINE, OCUSMA — 1:N joins yield one row per line
-- Tables : OOHEAD, OOLINE, OCUSMA
-- 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
oh.OACONO AS "Company",
oh.OAORNO AS "Customer order number — the key order lines join on",
CASE oh.OAORSL WHEN '00' THEN 'Entry in progress (no order lines)' WHEN '05' THEN 'Quotation' WHEN '10' THEN 'Preliminary' WHEN '20' THEN 'Final (released)' WHEN '22' THEN 'Left to allocate' WHEN '23' THEN 'Partially allocated' WHEN '24' THEN 'Partly to allocate, partly on printed picking list' WHEN '26' THEN 'Partly to allocate, partly delivered' WHEN '27' THEN 'Partly to allocate, partly invoiced' WHEN '33' THEN 'Allocated' WHEN '34' THEN 'Allocated, partly on printed picking list' WHEN '36' THEN 'Allocated, partly delivered' WHEN '37' THEN 'Allocated, partly invoiced' WHEN '44' THEN 'Picking list printed' WHEN '46' THEN 'Picking list printed, partly delivered' WHEN '47' THEN 'Picking list printed, partly invoiced' WHEN '66' THEN 'Delivered' WHEN '67' THEN 'Delivered, partly invoiced' WHEN '77' THEN 'Invoiced' WHEN '90' THEN 'Deleted (no open order lines)' WHEN '99' THEN 'Completed without delivery' ELSE oh.OAORSL END AS "Lowest line status on the order — with the highest status, brackets where the order's lines stand", -- status: ORST_HEAD (all 21 curated values)
CASE oh.OAORST WHEN '00' THEN 'Entry in progress (no order lines)' WHEN '05' THEN 'Quotation' WHEN '10' THEN 'Preliminary' WHEN '20' THEN 'Final (released)' WHEN '22' THEN 'Left to allocate' WHEN '23' THEN 'Partially allocated' WHEN '24' THEN 'Partly to allocate, partly on printed picking list' WHEN '26' THEN 'Partly to allocate, partly delivered' WHEN '27' THEN 'Partly to allocate, partly invoiced' WHEN '33' THEN 'Allocated' WHEN '34' THEN 'Allocated, partly on printed picking list' WHEN '36' THEN 'Allocated, partly delivered' WHEN '37' THEN 'Allocated, partly invoiced' WHEN '44' THEN 'Picking list printed' WHEN '46' THEN 'Picking list printed, partly delivered' WHEN '47' THEN 'Picking list printed, partly invoiced' WHEN '66' THEN 'Delivered' WHEN '67' THEN 'Delivered, partly invoiced' WHEN '77' THEN 'Invoiced' WHEN '90' THEN 'Deleted (no open order lines)' WHEN '99' THEN 'Completed without delivery' ELSE oh.OAORST END AS "Highest line status on the order", -- status: ORST_HEAD (all 21 curated values)
ol.OBPONR AS "Order line number",
ol.OBPOSX AS "Line suffix — subdivides a line when it is split (e.g. partial deliveries)",
CASE ol.OBORST WHEN '05' THEN 'Quotation' WHEN '10' THEN 'Preliminary' WHEN '22' THEN 'Left to allocate' WHEN '23' THEN 'Partially allocated' WHEN '24' THEN 'Partly to allocate, partly on printed picking list' WHEN '26' THEN 'Partly to allocate, partly delivered' WHEN '27' THEN 'Partly to allocate, partly invoiced' WHEN '33' THEN 'Allocated' WHEN '34' THEN 'Allocated, partly on printed picking list' WHEN '36' THEN 'Allocated, partly delivered' WHEN '37' THEN 'Allocated, partly invoiced' WHEN '44' THEN 'Picking list printed' WHEN '46' THEN 'Picking list printed, partly delivered' WHEN '47' THEN 'Picking list printed, partly invoiced' WHEN '66' THEN 'Delivered' WHEN '67' THEN 'Delivered, partly invoiced' WHEN '77' THEN 'Invoiced' WHEN '99' THEN 'Completed without delivery' ELSE ol.OBORST END AS "Line status — two independent numerals, lowest and furthest degree of processing, so mixed pairs like 46 mean partly picked, partly delivered", -- status: ORST_LINE (all 18 curated values)
ol.OBITNO AS "Item ordered",
c.OKSTAT AS "Customer status — whether the customer is active for new business", -- status: decode c.OKSTAT against your configuration — see quirks guide #statuses
c.OKCUNM AS "Customer name"
FROM <catalog>.<schema>.OOHEAD oh
LEFT JOIN <catalog>.<schema>.OOLINE ol
ON ol.OBORNO = oh.OAORNO
AND ol.OBCONO = oh.OACONO
LEFT JOIN <catalog>.<schema>.OCUSMA c
ON c.OKCUNO = oh.OACUNO
AND c.OKCONO = oh.OACONO
WHERE
oh.OACONO = <company>
ORDER BY oh.OAORNO;Backing Tables
How these tables connect — join details in the list below.
Join details
-- Uses this catalog's prefixed M3 column names; map raw Data Lake properties through Data Catalog first. ON OOHEAD.OAORNO = OOLINE.OBORNO AND OOHEAD.OACONO = OOLINE.OBCONO-- Uses this catalog's prefixed M3 column names; map raw Data Lake properties through Data Catalog first. ON OOHEAD.OACUNO = OCUSMA.OKCUNO AND OOHEAD.OACONO = OCUSMA.OKCONO
Joined tables
- OCUSMAThe customer master — one row per customer per company, with name and address, country, currency, and the default payment, delivery, and sales-rep terms new orders inheritPrefix: OKmaster
- OOLINEThe customer order line — one row per ordered item with quantities across the ordered/delivered/invoiced flow, price, warehouse, and planned delivery date; the core sell-side transaction, joined to its header by ORNOPrefix: OBtransaction