Create cost centers, cost center groups, and cost allocations
✓Works with OpenClaudeYou are an SAP CO (Controlling) consultant. The user wants to create cost centers, cost center groups, and set up cost allocations in SAP.
What to check first
- Run transaction
OX02to verify the controlling area and company code assignment exists - Check transaction
KS01to see if any cost centers already exist in your controlling area - Verify user has authorization object
K_CCTR(Cost Center) with activity 01 (Create)
Steps
- Open transaction
KS01(Create Cost Center) and select the controlling area - Enter the cost center key (e.g., "CC-SALES-01") and assign it to a cost center category (e.g., "F" for Functional area)
- Set the valid-from date and responsible person/cost center manager
- Populate the cost center attributes: name, description, department, location
- Assign the cost center to a cost center group in the "Group Assignment" section using transaction
KSH1 - Create cost center groups via
KSH1to organize cost centers hierarchically (e.g., "SALES-GROUP" containing all sales cost centers) - Configure cost allocations using transaction
KA01to define sender and receiver cost centers with allocation percentages - Run the cost allocation batch via transaction
KSUBor manually execute viaKA02(Execute Cost Allocation)
Code
*&---------------------------------------------------------------------*
*& Program: ZCOS_CENTER_SETUP
*& Description: Create cost centers, groups, and allocations in SAP CO
*&---------------------------------------------------------------------*
REPORT zcos_center_setup.
PARAMETERS:
p_carea TYPE cobrb-kokrs DEFAULT '1000',
p_cctr TYPE csks-kostl DEFAULT 'CC-SALES-01',
p_ccname TYPE csks-ktext DEFAULT 'Sales Cost Center',
p_group TYPE csks-grpkost DEFAULT 'SALES-GROUP'.
DATA: ls_csks TYPE csks,
ls_csgh TYPE csgh,
lt_cskh TYPE TABLE OF cskh,
lv_msgty TYPE bapi_mtype.
START-OF-SELECTION.
" Create cost center
ls_csks-kokrs = p_carea.
ls_csks-kostl = p_cctr.
ls_csks-ktext = p_ccname.
ls_csks-grpkost = p_group.
ls_csks-datab = sy-datum.
ls_csks-datbi = '99991231'.
ls_csks-verak = 'USER01'.
INSERT INTO csks VALUES ls_csks.
IF sy-subrc = 0.
WRITE: / 'Cost Center', p_cctr, 'created successfully.'.
ELSE.
WRITE: / 'Error
Note: this example was truncated in the source. See the GitHub repo for the latest full version.
Common Pitfalls
- Treating this skill as a one-shot solution — most workflows need iteration and verification
- Skipping the verification steps — you don't know it worked until you measure
- Applying this skill without understanding the underlying problem — read the related docs first
When NOT to Use This Skill
- When a simpler manual approach would take less than 10 minutes
- On critical production systems without testing in staging first
- When you don't have permission or authorization to make these changes
How to Verify It Worked
- Run the verification steps documented above
- Compare the output against your expected baseline
- Check logs for any warnings or errors — silent failures are the worst kind
Production Considerations
- Test in staging before deploying to production
- Have a rollback plan — every change should be reversible
- Monitor the affected systems for at least 24 hours after the change
Related SAP Skills
Other Claude Code skills in the same category — free to download.
ABAP Developer
Write clean ABAP code with modern syntax, CDS views, and best practices
SAP Fiori App
Build SAP Fiori applications with SAPUI5 and Fiori Elements
SAP BTP Setup
Set up and deploy applications on SAP Business Technology Platform
SAP HANA Query
Write and optimize SAP HANA SQL queries and calculation views
SAP OData Service
Create and consume OData services in SAP (V2 and V4)
SAP RFC Connector
Connect to SAP via RFC/BAPI from external applications
SAP CDS Model
Create Core Data Services models and annotations for SAP
SAP CAP App
Build full-stack applications with SAP Cloud Application Programming Model
Want a SAP skill personalized to YOUR project?
This is a generic skill that works for everyone. Our AI can generate one tailored to your exact tech stack, naming conventions, folder structure, and coding patterns — with 3x more detail.