Beyond ABAPdesigned by@Tejoram97
Beyond ABAP / FICO ABAP / Controlling – Cost Centers, Orders, Product Costing & Profitability

Controlling – Cost Centers, Orders, Product Costing & Profitability

FICO ABAP · Finance ·

Open the interactive lesson →
  1. CO concepts: cost elements as G/L accounts, primary and secondary costs
  2. Cost center accounting
  3. Activity types, statistical key figures and allocations
  4. Internal orders
  5. Profit center accounting in S/4HANA
  6. Product cost planning
  7. Cost object controlling: WIP, variances and settlement
  8. Material ledger and actual costing
  9. Profitability analysis: margin analysis and costing-based CO-PA
  10. Key tables, t-codes and released CDS views
  11. Interview questions

Controlling (CO) is internal accounting: it answers where costs arise (cost centers), what they were spent on (internal orders, production orders), what a product costs (product costing, material ledger) and which customers, products and regions make money (profitability analysis). FI reports to the outside world; CO steers the company from inside. In S/4HANA both live in the same Universal Journal ACDOCA, so CO no longer needs its own document tables or a reconciliation ledger. Controlling area and org structure: page 01; Universal Journal and document splitting: page 02; period-end closing sequence: page 05; CO BAdIs and APIs: page 06.

Part 1 – CO concepts: cost elements as G/L accounts, primary and secondary costs

All CO data belongs to a controlling area (OKKP, table TKA01) to which one or more company codes are assigned (TKA02). Every CO posting needs a cost object – cost center, order, WBS element, profitability segment – identified internally by the object number OBJNR (e.g. KS + controlling area + cost center, OR + order number).

Primary costs and revenue enter CO; cost centers collect overhead; allocations move it to orders and production orders; settlement passes costs to margin analysis and other receivers; everything in ACDOCA

1.1 Cost elements in S/4HANA

S/4HANA: cost elements are no longer separate master data. They are G/L accounts, maintained in FS00 (or the Fiori app Manage G/L Account Master Data) with a G/L account type and, for cost-relevant accounts, a cost element category. The ECC transactions KA01 – KA06 are replaced by FS00; FS00 still writes the cost element data (e.g. the category CSKB-KATYP) to CSKA / CSKB. Secondary cost elements therefore also exist as G/L accounts (type secondary costs) and appear in ACDOCA.

G/L account type

Meaning

CO relevance

Balance sheet account

Assets, liabilities, equity

Not in CO (except category 90 for asset accounts)

Nonoperating expense or income

P&L account without CO posting (e.g. extraordinary income)

No cost object needed

Primary costs or revenue

P&L account that also posts to CO

Cost object required (default account assignment OKB9 possible)

Secondary costs

Exists only for CO allocations (assessment, activity allocation, settlement)

Used only inside CO, nets to zero over the company

Category

Kind

Used for

1

Primary

Costs and cost-reducing revenues (material, salaries, depreciation)

11 / 12

Primary

Revenues / sales deductions

22

Primary

External settlement (order settled to G/L account, asset, material)

90

Primary

Statistical cost element for balance sheet accounts (e.g. asset acquisitions shown on investment orders)

21

Secondary

Internal settlement (order → cost center, order → profitability segment)

31

Secondary

Results analysis / WIP

41

Secondary

Overhead rates (costing sheet)

42

Secondary

Assessment

43

Secondary

Internal activity allocation

  • Primary costs come from outside CO (FI invoices, MM goods issues, payroll, depreciation) and always have an FI posting. Secondary costs arise inside CO when costs move between cost objects – no effect on the P&L total.
  • Cost element groups (KAH1) are used in reports, allocation cycles and planning layouts.

Part 2 – Cost center accounting

A cost center is an area of responsibility that incurs costs: production line, IT, HR, sales office. Overhead is collected there, planned, compared with actuals and finally allocated to the products and markets that caused it.

Object

T-code / app

Table

Notes

Cost center

KS01 / KS02 / KS03; Fiori Manage Cost Centers

CSKS, CSKT texts

Time-dependent (DATAB – DATBI); company code, profit center, category, person responsible

Standard hierarchy

OKEON

Set tables (SETHEADER / SETNODE)

Mandatory tree – every cost center is in exactly one node

Cost center groups

KSH1 – KSH3

Set tables

Alternative hierarchies for reports and allocations

Cost center category

OKA2

TKA05

Production, administration, sales … – defaults and allowed activity types

2.1 Planning

  • Classic CO planning: KP06 costs per cost center and cost element, KP26 activity quantities and prices, KSPI plan price calculation – still available on-premise.
  • S/4HANA: plan data is stored in ACDOCP (plan counterpart of ACDOCA) and is entered with SAP Analytics Cloud planning (integrated financial planning) or uploaded with the Fiori app Import Financial Plan Data. Plan/actual reports then read ACDOCA and ACDOCP.

2.2 Actual postings and reporting

  • Actual primary costs arrive with every FI / MM posting that carries the cost center (e.g. FB60 expense line, goods issue 201). Wrong postings are corrected with KB11N (repost costs) or KB41N (repost revenues).
  • Reports: KSB1 cost center line items, S_ALR_87013611 actual / plan / variance per cost center; Fiori analytical apps for cost center actuals and plan / actual comparison on ACDOCA / ACDOCP.
" Actual costs of one cost center per G/L account (cost element) – leading ledger, periods 1-3
SELECT racct, SUM( hsl ) AS amount, rhcur
FROM acdoca
WHERE rldnr  = '0L'                              " leading ledger
AND kokrs  = @p_kokrs                          " controlling area
AND rbukrs = @p_bukrs
AND gjahr  = @p_gjahr
AND poper  BETWEEN '001' AND '003'             " posting periods
AND rcntr  = @p_kostl                          " cost center
GROUP BY racct, rhcur
INTO TABLE @DATA(lt_costs).

Part 3 – Activity types, statistical key figures and allocations

Object

Meaning

T-code

Table

Activity type

Output of a cost center measured in units: machine hours, labour hours, IT tickets. Has a price per unit per period.

KL01 – KL03; price KP26

CSLA

Statistical key figure

Quantity used as a tracing factor: employees, square metres, phone lines

KK01 – KK03; actual values KB31N

TKA03

Overhead costing sheet

Percentage or quantity surcharges for overhead on orders

KZS2

–

3.1 Allocation methods

Method

How

Cost elements on the receiver

T-code (classic)

Direct activity allocation

Sender cost center × activity quantity × price → receiver (cost center, order)

Secondary, category 43

KB21N

Indirect activity allocation

Activity quantity derived from tracing factors, then valued at the price

Secondary, category 43

KSC1 / KSC5

Assessment

Allocates totals by tracing factor (%, statistical key figure); original cost elements are hidden

One assessment cost element (category 42)

KSU1 cycle, KSU5 run

Distribution

Allocates primary costs; receiver keeps the original primary cost elements

Original primary cost elements

KSV1 cycle, KSV5 run

Periodic reposting

Like distribution but for postings collected on a clearing cost center; less data, no sender history

Original cost elements

KSW1 / KSW5

Overhead surcharge

Costing sheet adds overhead to orders, credits cost centers

Secondary, category 41

KGI2, CO43

  • S/4HANA: universal allocation (since 1909) handles assessment, distribution and other allocations in one framework with Fiori apps Manage Allocations, Run Allocations and Allocation Results; it is the newer allocation tool (scope item 2QL); classic cycles can be migrated to it.
  • Actual activity price calculation KSII revalues allocated activities at the real price of the period (cost of the sender ÷ actual quantity).
  • Assessment vs distribution in one sentence: distribution keeps the cost element detail (only primary costs), assessment summarises everything into one secondary cost element.

Part 4 – Internal orders

An internal order collects costs of a task or event that is limited in time: a trade fair, a marketing campaign, a repair, an investment, an IT project. Costs are planned, budgeted, collected and then settled to their final receivers.

Internal order life cycle: create (KO01, order type), plan and budget (KO22, BPGE/BPJA), actual postings with availability control, period-end settlement (KO88 / KO8G, COBRA/COBRB), close; settlement receivers, settlement profile OKO7, allocation structure OKO6, statistical order

Order kind

Example

Settled to

Overhead order

Trade fair, training, repair

Cost center(s)

Investment order

Building a machine (with Investment Management)

Asset under construction, then fixed asset

Accrual order

Accrued costs calculated in CO

Cost centers

Order with revenues

Small customer service jobs

Profitability segment

Statistical order

Additional reporting on a real cost center posting

Never settled

  • Order type (KOT2_OPA): number range, order category 01, settlement profile, planning and budget profile, status profile, whether the order is statistical.
  • Budget and availability control (AVC): the budget profile of the order type sets tolerance limits – e.g. warning at 90 %, error at 100 % of the budget. Budget KO22 (original), KO24 (supplement), KO26 (return); totals in BPGE (overall) and BPJA (annual).
  • Settlement: the settlement rule (header COBRA, distribution rules COBRB) lists receivers with percentage or amount and settlement type PER (periodic) or FUL (full). KO88 settles one order, KO8G a selection of orders; the posting uses the settlement cost element from the allocation structure (OKO6).
  • Status: CRTD created → REL released (postings allowed) → TECO technically complete → CLSD closed (no more postings), stored in JEST. Line items KOB1, order overview KOK5; in code read the master data through the released view I_InternalOrder.
" Settlement rule of an internal order: receivers and percentages
DATA(lv_objnr) = CONV j_objnr( |OR{ p_aufnr }| ).  " object number = 'OR' + order number

SELECT lfdnr, konty, perbz, prozs, kostl, hkont, anln1, ps_psp_pnr
FROM cobrb
WHERE objnr = @lv_objnr
ORDER BY lfdnr
INTO TABLE @DATA(lt_rules).                      " konty = receiver type (CTR, G/L, FXA …)

Part 5 – Profit center accounting in S/4HANA

A profit center is a part of the company managed as if it were a business of its own (business unit, product line, region). Profit center accounting shows its revenues, costs and – with document splitting – its balance sheet.

  • S/4HANA: profit center accounting is part of the General Ledger. Every ACDOCA line carries PRCTR (and the partner profit center PPRCTR); there is no separate EC-PCA ledger. The ECC tables GLPCA / GLPCT and the transfer of balance sheet items to EC-PCA are legacy.
  • Document splitting by profit center and segment (page 02) splits payables, receivables, taxes and bank lines so that a full balance sheet per profit center or segment can be produced.
  • Master data: KE51 / KE52 / KE53 or Fiori Manage Profit Centers; table CEPC (with SEGMENT – the profit center decides the segment), texts CEPCT; standard hierarchy and groups (KCH1). A dummy profit center catches postings without assignment.
  • Derivation: profit center comes from the cost center (CSKS-PRCTR), the material per plant (MARC-PRCTR) for logistics postings and sales order items, the order or WBS element, or from substitution rules.
  • Transfer prices between profit centers can be valued in parallel with profit center valuation in the material ledger (Part 8).

Part 6 – Product cost planning

Product cost planning calculates what a product should cost – the standard cost estimate – from the bill of material (material costs), the routing (activities at their planned prices) and overhead. Released, it becomes the standard price of the material (price control S, MM ABAP › 03).

Plan lane: quantity structure, costing variant PPC1, cost estimate CK11N / CK40N with KEKO/KEPH/CKIS, mark and release CK24 to MBEW-STPRS; actual lane: production order, overhead, WIP and variances, settlement; material ledger and actual costing run CKMLCP

Element

What it controls

Customizing / t-code

Costing variant (e.g. PPC1 standard)

Costing type (which price field is updated), valuation variant (which prices for materials, activities, subcontracting, overhead), date control, quantity structure control, transfer control

OKKN

Cost component structure

Groups cost elements into components (raw material, labour, machine, overhead) for the cost component split

OKTZ

Material cost estimate

Cost estimate with quantity structure for one material

CK11N create, CK13N display

Costing run

Mass costing of many materials (selection, BOM explosion, costing, analysis, marking, release)

CK40N

Mark and release

Mark proposes the future price, release updates the standard price for the period

CK24

  • Tables: KEKO cost estimate header, KEPH cost components, CKIS itemization (each BOM item, activity and overhead line). The released price ends up in MBEW (STPRS) and in the material ledger.
  • A cost estimate is valid for a period; a new standard is usually released once a year or per quarter, after checking the costing run log.

Part 7 – Cost object controlling: WIP, variances and settlement

Cost object controlling collects the actual costs of production: material issued (261), activities confirmed, overhead; the goods receipt (101) credits the order at the standard price. What remains on the order at period end is either work in process (WIP) or a variance.

Scenario

Cost object

Typical use

Product cost by order

Production / process order

Discrete manufacturing, costs per lot

Product cost by period

Product cost collector (KKF6N)

Repetitive manufacturing, costs per period

Sales order controlling

Sales order item (make-to-order)

Costs and revenues per customer order

7.1 Period-end steps for production orders

Step

Individual / collective

Result

Overhead surcharge

KGI2 / CO43

Overhead from the costing sheet debited to the orders

WIP calculation (orders not delivered)

KKAX / KKAO

WIP at actual costs (results analysis key, category 31)

Variance calculation (delivered or TECO orders)

KKS2 / KKS1

Variance categories: input price, resource usage, input quantity, remaining input, lot size, mixed price, output price

Settlement

KO88 / CO88

WIP to the balance sheet; variances to the price difference account and margin analysis

  • Target costs (target cost version 0) = standard cost estimate × actual quantity delivered; variance = actual costs − target costs.
  • S/4HANA: event-based production accounting posts WIP when components are issued and settles variances automatically when the order is finally delivered – no period-end runs. It is the default in S/4HANA Cloud, public edition (scope item 3F0, successor of the period-based scope item BEI); on-premise and in the private cloud period-end processing is still the common approach.
  • Production order data: AUFK (order master), AFKO / AFPO (production order header / item, PP); costs in ACDOCA (order number in AUFNR, object number in OBJNR).

Part 8 – Material ledger and actual costing

S/4HANA: the material ledger (ML) is mandatory for inventory valuation (ECC: optional, activated per valuation area). It records every valuated movement per material and period, can value inventory in several currencies and valuations (legal, group, profit center valuation) and collects price differences per material. Actual costing on top of it is optional.

Topic

Detail

Without actual costing

Materials keep the standard (S) or moving average (V) price; ML gives multi-currency values and price difference reporting (CKM3 material price analysis)

With actual costing

Price differences are rolled up through all BOM levels at period end; the result is the periodic unit price (actual cost) used to revalue closing stock and consumption

Actual costing run

CKMLCP cockpit: selection, sequence determination, single-level and multilevel price determination, revaluation of consumption, post closing

Tables

CKMLHD ML header per material / valuation area; S/4HANA: ML documents MLDOC and cost component split MLDOCCCS replace the ECC documents (MLHD / MLIT / MLPP / MLCR) and most of the periodic ML tables

Postings

Inventory values and revaluations are ACDOCA lines; MBEW still exists, but its value fields are served from ML / ACDOCA

  • Architect note: actual costing adds a heavy period-end job and is chosen when legal or management reporting needs actual product costs (e.g. transfer pricing, some local GAAPs); many companies run ML without it.

Part 9 – Profitability analysis: margin analysis and costing-based CO-PA

Profitability analysis (CO-PA) reports the contribution margin per market segment – any combination of characteristics such as customer, product, product group, region, sales organization, distribution channel. The operating concern (KEA0) defines these characteristics; each controlling area is assigned to one operating concern.

Comparison: margin analysis (account-based, characteristics in ACDOCA, COGS at goods issue, reconciles with P&L, all editions) vs costing-based CO-PA (value fields, CE1xxxx tables, legacy, on-premise only); operating concern, characteristics, reporting

9.1 Margin analysis (account-based) – the S/4HANA default

  • Values are G/L accounts. The characteristics of the market segment are stored as extra columns in ACDOCA (standard fields plus customer fields WW… added when the operating concern is generated), so FI and CO-PA are one document and always reconcile.
  • S/4HANA additions: cost of goods sold posted at goods issue with the market segment, COGS split into cost components, production variances by variance category, assessment and settlement to the market segment – all in the Universal Journal.
  • Characteristic derivation (KEDR) fills characteristics from rules and tables, e.g. region from customer, product group from material. Assessment of cost center costs to CO-PA: KEU5 (or universal allocation).
  • Reports: KE30 profitability reports, KE24 line items, embedded analytics queries on ACDOCA (page 05).

9.2 Costing-based CO-PA – legacy

  • Values are stored in value fields (revenue, discounts, freight, standard cost components …) in tables generated per operating concern: CE1xxxx actual line items, CE2xxxx plan line items, CE3xxxx segment level (totals), CE4xxxx segment table (characteristic combinations).
  • Advantages that kept it alive: expected COGS valued at billing, value field mapping from SD conditions (KE4I), flexible top-down distribution (KE28). Disadvantage: separate data that must be reconciled with FI.
  • Still available on-premise and can run in parallel to margin analysis, but SAP no longer develops it; it is not available in S/4HANA Cloud, public edition, or with Universal Parallel Accounting. Greenfield recommendation: margin analysis only.

Part 10 – Key tables, t-codes and released CDS views

Table

Content

S/4HANA

TKA01 / TKA02

Controlling area / company code assignment

Unchanged

SKA1 / SKB1

G/L account (chart of accounts / company code)

Master of cost elements

CSKA / CSKB

Cost element (chart of accounts / controlling area)

Still filled (category KATYP), maintained only through FS00

CSKS / CSKT

Cost center master / texts

Unchanged

CSLA

Activity types

Unchanged

AUFK

Order master (internal, production, maintenance orders)

Unchanged

COBRA / COBRB

Settlement rule header / distribution rules

Unchanged

CEPC / CEPCT

Profit center master / texts

Unchanged

KEKO / KEPH / CKIS

Cost estimate header / cost components / itemization

Unchanged

CKMLHD, MLDOC

Material ledger header, ML documents

MLDOC is S/4HANA

COEP / COSP / COSS

CO line items / totals primary / totals secondary

Compatibility views; actuals come from ACDOCA – new code reads ACDOCA

GLPCA / GLPCT

EC-PCA line items / totals

Legacy – profit center in ACDOCA

CE1xxxx – CE4xxxx

Costing-based CO-PA

Legacy, on-premise / Private Edition only

ACDOCA / ACDOCP

Universal Journal actuals / plan

S/4HANA

Released CDS view

Content

I_CostCenter

Cost center master data (time-dependent)

I_ProfitCenter

Profit center master data

I_InternalOrder

Internal order master data and status

I_GLAccountInChartOfAccounts

G/L account = cost element

I_JournalEntryItem

Universal Journal line items with all CO account assignments

I_GLAccountLineItem

G/L line items for reporting

Area

Key t-codes

Cost elements

FS00 (KA01 – KA06 replaced), KAH1 groups, OKB9 default account assignment

Cost centers

KS01 – KS03, OKEON, KSH1, KP06, KSB1, S_ALR_87013611, KB11N

Activities / allocations

KL01, KP26, KB21N, KK01, KB31N, KSU5, KSV5, KSW5, KSII; Manage Allocations

Internal orders

KO01 – KO03, KOT2_OPA, KO22, KO88, KO8G, KOB1, KOK5

Profit centers

KE51 – KE53, KCH1; Manage Profit Centers

Product costing

CK11N, CK13N, CK24, CK40N, OKKN, OKTZ, KKF6N

Period end (production)

CO43, KKAO, KKS1, CO88, CKMLCP, CKM3

CO-PA

KEA0, KEA5, KEA6, KEDR, KE30, KE24, KEU5, KE28

Part 11 – Interview questions

Q1. What happened to cost elements in S/4HANA?

They became G/L accounts. Primary and secondary cost elements are created in FS00 with G/L account type 'primary costs or revenue' or 'secondary costs' and a cost element category. KA01 – KA06 are replaced; FS00 still fills CSKA / CSKB in the background. Secondary costs are therefore visible in ACDOCA.

Q2. What is the difference between primary and secondary costs?

Primary costs come from outside CO with an FI posting (invoices, goods issues, payroll, depreciation). Secondary costs arise inside CO when costs are moved – assessment, activity allocation, overhead, internal settlement – and net to zero for the company.

Q3. Assessment vs distribution – when do you use which?

Distribution moves primary costs and keeps the original cost elements on the receiver – good when the receiver must see the cost type. Assessment moves primary and secondary costs under one assessment cost element (category 42) – simpler, less data, but the detail is lost.

Q4. How does an internal order get rid of its costs?

Through settlement (KO88 / KO8G) according to its settlement rule (COBRA / COBRB): receivers such as cost centers, G/L accounts, assets, WBS elements or profitability segments, with percentages or amounts. Settlement profile and allocation structure control receivers and cost elements.

Q5. What is a statistical internal order?

An order that receives costs only for information, in parallel to the real cost object (usually a cost center). It is never settled and cannot be the only account assignment of a posting.

Q6. How is profit center accounting different in S/4HANA?

It is integrated into the G/L: PRCTR is a field of every ACDOCA line and document splitting gives a balance sheet per profit center and segment. The separate EC-PCA ledger (GLPCA / GLPCT) and its periodic transfers are gone.

Q7. Explain the standard cost estimate process.

With a costing variant (e.g. PPC1) the system explodes BOM and routing, values materials and activities, adds overhead and builds the cost component split (CK11N single, CK40N mass). The estimate is marked and released with CK24 and becomes the standard price in MBEW. Data in KEKO, KEPH, CKIS.

Q8. What happens at period end on a production order?

Overhead (CO43), WIP for orders not yet delivered (KKAO), variances for delivered or TECO orders (KKS1: actual minus target costs by variance category), then settlement (CO88) – WIP to the balance sheet, variances to price differences and margin analysis. In public cloud, event-based production accounting does this in real time.

Q9. Is the material ledger mandatory? What about actual costing?

In ECC the material ledger was optional; in S/4HANA it is mandatory for inventory valuation (multi-currency, price differences, MLDOC documents). Actual costing (CKMLCP, periodic unit price) remains optional and is activated only when actual product costs are needed.

Q10. Margin analysis or costing-based CO-PA for a greenfield project?

Margin analysis: it is account-based, stored in ACDOCA, reconciles with the P&L, offers COGS split and variance detail at the market segment, and is the only option in public cloud and Universal Parallel Accounting. Costing-based CO-PA (value fields, CE1xxxx tables) is legacy and only for on-premise / Private Edition systems that cannot yet live without it.

Q11. A developer must report cost center actuals in S/4HANA. Which source?

ACDOCA (or the released view I_JournalEntryItem / I_GLAccountLineItem in clean core) filtered by ledger, controlling area, cost center, fiscal year and period; plan data from ACDOCP. COSP / COSS still answer SELECTs as compatibility views, but they are slower and not for new code.

Q12. Architect view: which CO design decisions must be taken early in a greenfield project?

Number of controlling areas (usually one; all its company codes share the operational chart of accounts and fiscal year variant), profit center and segment design with document splitting, cost center standard hierarchy, margin analysis characteristics in the operating concern, use of actual costing, event-based vs period-end production accounting, and whether planning moves to SAP Analytics Cloud.

🏠 Start Here · ◀ 03 · AP, AR & Assets · 05 · Integration & Close ▶ · Sections: CORE ABAP | OOPS ABAP | ABAP on HANA | Clean Core | RAP | ABAP Points | SAP Fiori | SAPUI5 | Mobile Development (MDK) | BTP Foundations | BTP Development | CAP | SAP Build | ABAP on BTP | Integration Suite | SAP Business AI | SAP BASIS | Security | SAP SDLC

Functional: FICO ABAP | TRM ABAP | VIM | SAP BIS | SD ABAP | MM ABAP | PP ABAP | QM ABAP | PM ABAP | PS ABAP | EWM | TM ABAP | GTM ABAP | EHS ABAP | HR ABAP | BW | SAP Datasphere | SAP Business Data Cloud | SAP MDG | SAP Analytics Cloud | SAP Ariba | SAP CX | SAP IBP