Skip to content
SAP Reference

XD01

CreateS/4HANA status: Replaced

Create Customer (Centrally)

Module: SD · Sales & DistributionS/4HANA replacement: BP
Notes

Customer master maintenance is consolidated into the Business Partner transaction (BP) via Customer/Vendor Integration (CVI) in S/4HANA.

Boilerplate SQL

Databricks SQL

Starting 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
-- ============================================================
-- T-Code : XD01 Create Customer (Centrally)
-- Purpose: Create customer master centrally (general + company code + sales area)
-- Grain  : One row per customer / sales area combination
-- Tables : KNA1, KNB1, KNVV, T001, TVKOT
-- Notes  : KNA1 = general, KNB1 = company-code (accounting), KNVV = sales-area (sales org / distribution channel / division). In S/4HANA, the Business Partner (BUT000) replaces customer master — this ECC pattern still works via compatibility views.
-- ============================================================
SELECT
  -- Keys
  c.MANDT   AS "Client",
  c.KUNNR   AS "Customer",
  kb.BUKRS  AS "Company Code",
  kv.VKORG  AS "Sales Organization",
  kv.VTWEG  AS "Distribution Channel",
  kv.SPART  AS "Division",

  -- Descriptive text
  c.NAME1   AS "Customer Name",
  c.NAME2   AS "Customer Name 2",

  -- Dates
  c.ERDAT   AS "Created On",
  c.UPDAT   AS "Changed On",

  -- Status / indicators
  c.LOEVM   AS "Central Deletion Flag",
  c.SPERR   AS "Central Posting Block",

  -- Org fields
  c.ORT01   AS "City",
  c.PSTLZ   AS "Postal Code",
  c.LAND1   AS "Country",
  c.REGIO   AS "Region",
  c.TELF1   AS "Telephone",
  c.STCEG   AS "VAT Registration Number",
  cc.BUTXT  AS "Company Code Name",
  so.VTEXT  AS "Sales Organization Name",

  -- Master data enrichment
  c.KTOKD   AS "Customer Account Group",
  kb.AKONT  AS "Reconciliation Account",
  kb.ZTERM  AS "Terms of Payment (FI)",
  kv.KDGRP  AS "Customer Group",
  kv.BZIRK  AS "Sales District",
  kv.KLABC  AS "ABC Classification",
  kv.ZTERM  AS "Terms of Payment (SD)"
FROM <catalog>.<schema>.kna1 c
LEFT JOIN <catalog>.<schema>.knb1 kb
  ON  kb.MANDT = c.MANDT
  AND kb.KUNNR = c.KUNNR
LEFT JOIN <catalog>.<schema>.knvv kv
  ON  kv.MANDT = c.MANDT
  AND kv.KUNNR = c.KUNNR
LEFT JOIN <catalog>.<schema>.t001 cc
  ON  cc.MANDT = kb.MANDT
  AND cc.BUKRS = kb.BUKRS
LEFT JOIN <catalog>.<schema>.tvkot so
  ON  so.MANDT = kv.MANDT
  AND so.VKORG = kv.VKORG
  AND so.SPRAS = 'E'
WHERE
  c.MANDT = '<MANDT>'
  AND c.KUNNR = '<KUNNR>'
  -- AND kv.VKORG = '<VKORG>'
  -- AND c.LOEVM <> 'X'
ORDER BY c.KUNNR, kb.BUKRS, kv.VKORG;

Tables Used by This Transaction

How these tables connect. Nodes are clickable.