SAP Reference
MIRO
Create S/4HANA status: ActiveEnter Incoming Invoice
What the badges mean
- S/4HANA status: Active
- Active and unchanged in S/4HANA.
- S/4HANA status: Deprecated
- Still readable today, but no longer SAP's strategic path — plan around it.
- S/4HANA status: Replaced
- Replaced by a new persistence in S/4HANA; the classic name may still answer reads (see read mechanism).
- S/4HANA status: Migrating to IBP
- Planning scope is moving from APO toward IBP.
- S/4HANA status: Active (StRM) · Replaced (EWM)
- Path-dependent: active with SAP Stock Room Management, replaced where EWM is the warehouse path.
- S/4HANA status: Replaced · Compat View
- Compatibility view: the classic table name is redirected to a view over the new persistence — see how the physical model moved.
- S/4HANA status: Active · Proxy View
- Proxy view: reads route through NSDM proxy/CDS views — see how the physical model moved.
- master
- Data class: what the table holds — master data, transaction documents, org structure, config, or texts (one row per language — see the quirks guide).
In field listings, K marks a primary-key field, and linked type codes in the Type column jump to the matching quirks-guide section.
Boilerplate SQL
Databricks SQLStarting point for querying the tables behind this transaction. Set your Unity Catalog location and filter values below — they’re substituted into the SQL and the copy button.
Query parameters
6 parameters not filled: <catalog>, <schema>, <MANDT>, <DATE_FROM>, <DATE_TO>, <LIFNR>
-- ============================================================
-- T-Code : MIRO Enter Incoming Invoice
-- Purpose: Enter a vendor invoice and post the matching accounting document + PO history
-- Grain : One row per invoice accounting line (BKPF header + BSEG line)
-- Tables : BKPF, BSEG, LFA1, T001, T003T, EKBE (commented optional)
-- Notes : MIRO updates EKBE with VGABE = '2' (invoice receipt) asynchronously. Bridge BSEG ↔ EKBE via EBELN + EBELP; primary key to MIRO invoice doc is RBKP/RSEG for the logistics view.
-- ============================================================
SELECT
-- Keys
h.MANDT AS "Client",
h.BUKRS AS "Company Code",
h.BELNR AS "Invoice Accounting Document",
h.GJAHR AS "Fiscal Year",
l.BUZEI AS "Line Item",
-- Descriptive text
dt.LTEXT AS "Document Type Description",
h.XBLNR AS "Vendor Invoice Reference",
l.SGTXT AS "Item Text",
-- Amounts + Currency (paired)
l.DMBTR AS "Amount in Local Currency",
l.WRBTR AS "Amount in Document Currency",
h.WAERS AS "Currency",
l.MWSKZ AS "Tax Code",
-- Dates
h.BUDAT AS "Posting Date",
h.BLDAT AS "Invoice Document Date",
h.CPUDT AS "Entered On",
-- Status / indicators
h.BLART AS "Document Type",
l.SHKZG AS "Debit/Credit Indicator",
l.KOART AS "Account Type",
h.STBLG AS "Reversal Document",
-- Org fields
cc.BUTXT AS "Company Code Name",
-- Master data enrichment
l.HKONT AS "G/L Account",
l.LIFNR AS "Vendor",
v.NAME1 AS "Vendor Name",
l.EBELN AS "Purchase Order",
l.EBELP AS "PO Item",
h.AWKEY AS "Object Key (RBKP|GJAHR)",
h.USNAM AS "User Name"
FROM <catalog>.<schema>.bkpf h
INNER JOIN <catalog>.<schema>.bseg l
ON l.MANDT = h.MANDT
AND l.BUKRS = h.BUKRS
AND l.BELNR = h.BELNR
AND l.GJAHR = h.GJAHR
LEFT JOIN <catalog>.<schema>.lfa1 v
ON v.MANDT = l.MANDT
AND v.LIFNR = l.LIFNR
LEFT JOIN <catalog>.<schema>.t001 cc
ON cc.MANDT = h.MANDT
AND cc.BUKRS = h.BUKRS
LEFT JOIN t003t dt
ON dt.MANDT = h.MANDT
AND dt.BLART = h.BLART
AND dt.SPRAS = 'E'
WHERE
h.MANDT = '<MANDT>'
AND h.BLART IN ('RE','RN','KR','KG')
AND h.BUDAT BETWEEN '<DATE_FROM>' AND '<DATE_TO>'
-- AND l.LIFNR = '<LIFNR>'
ORDER BY h.BUDAT DESC, h.BELNR, l.BUZEI;
-- Optional: PO history rows created by this invoice (VGABE = '2').
-- SELECT e.EBELN, e.EBELP, e.BELNR AS invoice_doc, e.GJAHR, e.BUDAT,
-- e.MENGE, e.DMBTR, e.WRBTR
-- FROM <catalog>.<schema>.ekbe e
-- WHERE e.MANDT = '<MANDT>'
-- AND e.VGABE = '2'
-- AND e.BUDAT BETWEEN '<DATE_FROM>' AND '<DATE_TO>';Tables Used by This Transaction
How these tables connect — join details in the list below.
R read · W write · R/W read + write