SAP Reference
VF03
DisplayS/4 · ActiveDisplay Billing Document
Boilerplate SQL
Databricks SQLStarting point for querying the tables behind this transaction. Adjust the WHERE clause for your scenario.
-- ============================================================
-- T-Code : VF03 Display Billing Document
-- Purpose: Display a billing document with items and accounting status
-- Grain : One row per billing-document item
-- Tables : VBRK, VBRP, MAKT, MARA, KNA1, T001, TVKO
-- Notes : VBRK.FKSTO = 'X' indicates a cancelled billing document — filter it out for revenue reports. RFBSK = 'C' means fully transferred to accounting.
-- ============================================================
SELECT
-- Keys
h.MANDT AS "Client",
h.VBELN AS "Billing Document",
l.POSNR AS "Item",
-- Descriptive text
l.ARKTX AS "Item Short Text",
mt.MAKTX AS "Material Description",
-- Quantities + UOM (paired)
l.FKIMG AS "Billed Quantity",
l.VRKME AS "Sales Unit",
l.NETWR AS "Net Value",
l.MWSBP AS "Tax Amount",
h.WAERK AS "Document Currency",
h.KURRF AS "Exchange Rate",
-- Dates
h.FKDAT AS "Billing Date",
h.ERDAT AS "Created On",
h.BUDAT AS "Posting Date",
-- Status / indicators
h.FKSTO AS "Cancellation Flag",
h.RFBSK AS "Accounting Transfer Status",
h.SFAKN AS "Cancellation Reference",
-- Org fields
h.VKORG AS "Sales Organization",
so.VTEXT AS "Sales Organization Name",
h.VTWEG AS "Distribution Channel",
h.SPART AS "Division",
h.BUKRS AS "Company Code",
cc.BUTXT AS "Company Code Name",
l.WERKS AS "Plant",
-- Master data enrichment
h.FKART AS "Billing Type",
h.KUNAG AS "Sold-To Party",
h.KUNRG AS "Payer",
c.NAME1 AS "Payer Name",
l.MATNR AS "Material Number",
m.MTART AS "Material Type",
m.MATKL AS "Material Group",
l.VGBEL AS "Reference Document (Delivery)",
l.VGPOS AS "Reference Item"
FROM vbrk h
INNER JOIN vbrp l
ON l.MANDT = h.MANDT
AND l.VBELN = h.VBELN
LEFT JOIN makt mt
ON mt.MANDT = l.MANDT
AND mt.MATNR = l.MATNR
AND mt.SPRAS = 'E'
LEFT JOIN mara m
ON m.MANDT = l.MANDT
AND m.MATNR = l.MATNR
LEFT JOIN kna1 c
ON c.MANDT = h.MANDT
AND c.KUNNR = h.KUNRG
LEFT JOIN t001 cc
ON cc.MANDT = h.MANDT
AND cc.BUKRS = h.BUKRS
LEFT JOIN tvko so
ON so.MANDT = h.MANDT
AND so.VKORG = h.VKORG
WHERE
h.MANDT = '100'
AND h.FKDAT BETWEEN '<DATE_FROM>' AND '<DATE_TO>'
AND h.FKSTO = ''
-- AND h.VKORG = '<VKORG>'
ORDER BY h.FKDAT DESC, h.VBELN, l.POSNR;Tables Used by This Transaction
How these tables connect. Nodes are clickable.