R4981
Batch UBEFreight Update and Report — the batch job that finalizes freight after delivery confirmation: writes freight audit history, books payable freight accruals/vouchers, and adds billable freight charges to the customer's order
Rows written by R4981 carry …PID = 'R4981' in their audit columns — a ready-made marker for isolating the records this program produced. See the audit-columns guide →
The freight step that moves transportation costs into the G/L and A/P; writes the F4981 audit history.
Boilerplate SQL
Databricks SQLStarting point for querying the tables behind this program. Set your Unity Catalog location and filter values below — they’re substituted into the SQL and the copy button.
-- ============================================================
-- Program: R4981 Freight Update and Report — the batch job that finalizes freight after delivery confirmation: writes freight audit history, books payable freight accruals/vouchers, and adds billable freight charges to the customer's order
-- Purpose: Freight Update and Report — the batch job that finalizes freight after delivery confirmation: writes freight audit history, books payable freight accruals/vouchers, and adds billable freight charges to the customer's order — auto-generated boilerplate from program-table-map
-- Grain : F4981 × F4215, F4211, F0911, F0411 — 1:N joins yield one row per detail line
-- Tables : F4981, F4215, F4211, F0911, F0411
-- Notes : Auto-generated skeleton. Julian dates are converted to DATE and implied-decimal amounts are scaled (verify decimals in F9210). Audit columns (…USER/…PID/…UPMJ) are omitted — see the quirks guide. Set catalog/schema to your Unity Catalog location; fill remaining placeholders (<...>) for your tenant.
-- ============================================================
SELECT
h.FHUK01 AS "Internal unique key - the physical primary key of this table.",
f.XHSHPN AS "Shipment number - the system-assigned key that groups order lines for transport; the same value lands on F4211.SDSHPN.",
d.SDKCOO AS "Order key company - disambiguates order numbers across companies",
d.SDDOCO AS "Order number",
d.SDDCTO AS "Order type code (SO, ST, CO, ...)",
d.SDLNID / POWER(10, 3) AS "Order line number, stored x1000 (3 implied decimals)", -- implied decimals: 3 (verify in F9210)
f0.GLDCT AS "Document type of the journal entry (JE, PV, RI, etc.).",
f0.GLDOC AS "Document number of the journal entry.",
f0.GLKCO AS "Company that assigned the document number (key company).",
CASE WHEN f0.GLDGJ IS NULL OR f0.GLDGJ = 0 THEN NULL ELSE DATE_ADD(MAKE_DATE(1900 + CAST(f0.GLDGJ AS INT) DIV 1000, 1, 1), CAST(f0.GLDGJ AS INT) % 1000 - 1) END AS "G/L date driving the fiscal period the line posts to.", -- CYYDDD Julian → DATE
f0.GLJELN AS "Line number within the journal entry.",
f0.GLEXTL AS "Line extension code completing the unique key.",
f0.GLLT AS "Ledger type the line belongs to (AA actual, CA foreign currency, etc.).",
f04.RPKCO AS "Document company that owns the voucher number sequence",
f04.RPDCT AS "Voucher document type (PV standard voucher, PD debit memo, PL logged, etc.)",
f04.RPSFX AS "Pay item — vouchers split into pay items with independent terms and status",
f04.RPSFXE AS "Pay item extension used by prepayments and multi-tax-rate splits"
FROM <catalog>.<schema_data>.f4981 h
LEFT JOIN <catalog>.<schema_data>.f4215 f
ON 1 = 1 -- TODO: define join condition (no shared aliases detected)
LEFT JOIN <catalog>.<schema_data>.f4211 d
ON 1 = 1 -- TODO: define join condition (no shared aliases detected)
LEFT JOIN <catalog>.<schema_data>.f0911 f0
ON 1 = 1 -- TODO: define join condition (no shared aliases detected)
LEFT JOIN <catalog>.<schema_data>.f0411 f04
ON f04.RPDOC = h.FHDOC
ORDER BY h.FHUK01;2 parameters not filled: <catalog>, <schema_data>
Tables Used by This Program
How these tables connect. Nodes are clickable.
Secondary tables
- F0411Accounts payable ledger: one row per voucher pay item with gross, open, discount, and tax amounts, due dates, pay status, and the PO keys behind three-way match.Write accesstransaction
- F0911General ledger transaction detail: every journal entry line with its account, G/L date, amount, batch, subledger, and source-document references.Write accesstransaction
- F4211Sales order detail — one row per order line; the core sales transaction tableWrite accesstransaction
- F4215One row per shipment - the anchor record Transportation Management creates when order lines are grouped for delivery; despite the F42xx name it belongs to system 49. Carries status, mode, geography, weight, value, and promised dates.Read/write accesstransaction