Cost Center Master Data Table in SAP using SQL Query

Cost Center Master Data Table in SAP using SQL Query

In SAP’s Controlling (CO) module, the cost center master data is crucial for organizing and tracking costs associated with various business operations. Cost centers help organizations assign costs to the departments, services, or functions that generate them. The key table for storing cost center master data is CSKS (Cost Center Master Data), but there are other related tables such as CSKT (Cost Center Texts) and CSKV (Time-Dependent Cost Center Data) that provide additional information.

In this post, we will explore the structure of the cost center master table in sap, highlight key fields, and show how you can use SQL to extract relevant data and combine it with other tables to answer important business questions.

Key Tables for Cost Center Master table in SAP

  1. CSKS – Cost Center Master Data
    • KOKRS: Controlling area
    • KOSTL: Cost center
    • LTEXT: Cost center description
    • VERAK: Person responsible
    • BUKRS: Company code
    • GSBER: Business area
    • DATBI: Valid-to date
    • DATAB: Valid-from date
  2. CSKT – Cost Center Texts
    • KOKRS: Controlling area
    • KOSTL: Cost center
    • SPRAS: Language key
    • KTEXT: Short description (in a specific language)
  3. CSKV – Time-Dependent Cost Center Data
    • KOKRS: Controlling area
    • KOSTL: Cost center
    • DATBI: Valid-to date
    • DATAB: Valid-from date

Learn about Profit Center Table in SAP

Common Business Questions and Queries

1. Extract Basic Cost Center Information

If you need to retrieve the basic master data of all cost centers, the CSKS table is your go-to table. The query below fetches the cost center number, controlling area, and the person responsible along with the description.

SELECT 
    KOSTL AS "Cost Center",
    LTEXT AS "Description",
    VERAK AS "Person Responsible",
    BUKRS AS "Company Code"
FROM 
    CSKS
WHERE 
    KOKRS = '1000';  -- Example controlling area

2. Retrieve Cost Center Descriptions in Different Languages

The CSKT table stores cost center descriptions in multiple languages. If you need to retrieve the short description of cost centers in English, you can join CSKS with CSKT.

SELECT 
    CSKS.KOSTL AS "Cost Center",
    CSKS.LTEXT AS "Description",
    CSKT.KTEXT AS "Short Description (English)"
FROM 
    CSKS
INNER JOIN 
    CSKT ON CSKS.KOSTL = CSKT.KOSTL
WHERE 
    CSKS.KOKRS = '1000' 
    AND CSKT.SPRAS = 'E';  -- 'E' for English language

3. Retrieve Time-Dependent Cost Center Information

Cost centers can have validity periods, which are stored in the CSKV table. To retrieve cost centers that are valid for a specific date range, you can query the CSKS and CSKV tables.

SELECT 
    CSKS.KOSTL AS "Cost Center",
    CSKS.LTEXT AS "Description",
    CSKV.DATAB AS "Valid From",
    CSKV.DATBI AS "Valid To"
FROM 
    CSKS
INNER JOIN 
    CSKV ON CSKS.KOSTL = CSKV.KOSTL
WHERE 
    CSKS.KOKRS = '1000'
    AND CSKV.DATAB <= '20240101'  -- Example start date
    AND CSKV.DATBI >= '20231231';  -- Example end date

4. Combine Cost Center and Hierarchy Information

To retrieve the hierarchy of cost centers, you can use the SETHEADER and SETNODE tables, which store hierarchy data. The following query retrieves cost centers along with their hierarchy groups.

SELECT 
    CSKS.KOSTL AS "Cost Center",
    CSKS.LTEXT AS "Description",
    SETHEADER.SETCLASS AS "Hierarchy Group"
FROM 
    CSKS
INNER JOIN 
    SETNODE ON CSKS.KOSTL = SETNODE.NODEID
INNER JOIN 
    SETHEADER ON SETNODE.SETID = SETHEADER.SETID
WHERE 
    SETHEADER.SETCLASS = '0101'  -- '0101' is for cost centers
    AND CSKS.KOKRS = '1000';

5. Retrieve Cost Center Allocations and Totals

If you need to analyze cost center allocations or totals, you can join CSKS with COEP (Controlling Documents) or COSP (Controlling Totals) to get the cost allocations.

SELECT 
    CSKS.KOSTL AS "Cost Center",
    COSP.WTG001 AS "Total Costs",
    COSP.GJAHR AS "Fiscal Year"
FROM 
    CSKS
INNER JOIN 
    COSP ON CSKS.KOSTL = COSP.KOSTL
WHERE 
    CSKS.KOKRS = '1000'
    AND COSP.GJAHR = '2023';  -- Example fiscal year

Conclusion

The CSKS table, along with related tables like CSKT and CSKV, forms the foundation of cost center master data in SAP. By understanding how these tables interact and using SQL queries effectively, you can extract vital information for reporting and analysis.

Whether you are working on cost center hierarchies, managing time-dependent data, or analyzing cost allocations, these queries should provide a solid starting point for backend work in SAP’s CO module. Keep these key fields and table relationships in mind to answer complex business questions and optimize financial operations.

To Learn more about MARA Table in SAP

Similar Posts