Skip to content
SAP Reference

KS02

ChangeS/4HANA status: Active

Change Cost Center

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 : KS02 Change Cost Center
-- Purpose: Change cost center attributes
-- Grain  : One row per cost center / validity period
-- Tables : CSKS, CSKT, T001, TKA01
-- Notes  : CSKS is the cost-center master; CSKT carries the description per language and validity period. Filter DATBI + DATAB on both if you want only currently-valid rows. CSKS has no deletion-flag field — a cost center's validity is date-based (DATAB/DATBI), so 'deletion' is expressed as an expired validity period, not a flag.
-- ============================================================
SELECT
  -- Keys
  cs.MANDT  AS "Client",
  cs.KOKRS  AS "Controlling Area",
  cs.KOSTL  AS "Cost Center",

  -- Descriptive text
  ct.KTEXT  AS "Cost Center Name",
  ct.LTEXT  AS "Cost Center Long Text",

  -- Dates
  cs.DATAB  AS "Valid From",
  cs.DATBI  AS "Valid To",
  cs.ERSDA  AS "Created On",

  -- Status / indicators
  cs.PKZKP  AS "Primary Lock - Planning",
  cs.BKZKP  AS "Primary Lock - Actual",

  -- Org fields
  cs.BUKRS  AS "Company Code",
  cc.BUTXT  AS "Company Code Name",
  cs.WERKS  AS "Plant",
  cs.GSBER  AS "Business Area",
  cs.ABTEI  AS "Department",

  -- Master data enrichment
  cs.KOSAR  AS "Cost Center Category",
  cs.VERAK  AS "Person Responsible",
  cs.KHINR  AS "Hierarchy Area",
  cs.PRCTR  AS "Profit Center",
  cs.WAERS  AS "Currency"
FROM <catalog>.<schema>.csks cs
LEFT JOIN <catalog>.<schema>.cskt ct
  ON  ct.MANDT = cs.MANDT
  AND ct.KOKRS = cs.KOKRS
  AND ct.KOSTL = cs.KOSTL
  AND ct.DATBI = cs.DATBI
  AND ct.SPRAS = 'E'
LEFT JOIN <catalog>.<schema>.t001 cc
  ON  cc.MANDT = cs.MANDT
  AND cc.BUKRS = cs.BUKRS
WHERE
  cs.MANDT = '<MANDT>'
  AND cs.KOKRS = '<KOKRS>'
  -- AND cs.KOSTL = '<KOSTL>'
  -- AND cs.DATBI >= '<AS_OF_DATE>'
ORDER BY cs.KOKRS, cs.KOSTL;

Tables Used by This Transaction

How these tables connect. Nodes are clickable.