Specifications for Actual Cost Components Report in Material Ledger

SAP Component Report


We need to create a specification for a programmer to create a report in Material Ledger. The report (which will be run monthly) should show the actual cost components of a produced finished good as follows:

  • Raw materials
  • Semi Finished Goods
  • Labor
  • Overhead
  • Freight

We want the Raw materials and Semi finished goods line to be broken out into the actual material numbers that make up those lines. We are using a standard make-to-stock process with production orders, and we use material ledger to revalue the products at the end of the month. Please provide the necessary tables/fields and logic that is needed in order to pass this information to a programmer.



A) Identify KALNR (Cost estimate number)

  • Table MBEW, input Material (MBEW-MATNR) and Valuation Area / Plant (MBEW-BWKEY), output Product Cost Estimate Number (MBEW-KALN1) KALN1 then become KALNR in all ML tables

  • Alternatively, look for KALNR in table CKMLHD (note: Material and Plant are not key fields in CKMLHD, they are key fields in MBEW. Developer may decide which of the two tables provides an optimum fetch from the performance standpoint. One would get the correct output from functional standpoint)


B) Identify documents posted for this material:

  • Use function module CKM8N_DOCUMENT_REPORT
    • Input: KALNR, Year, Period
    • Output: Individual documents posted in ML for given material in given year and period
  • Alternatively, you may use tables MLHD and MLIT to pull this information. However, one needs document number as a key field. Without which, the performance of the report will not be optimum


C) Identify details for each document:

  • Field BVALT (Procurement alternative/process); data element CKML_ALPROCNR will provide the link between the header material (KALNR) and the component materials / inputs.
  • Procurement Alternatives are stored in tables CKMLMV001 and CKMLMV002 (and few more in CKMLV* range)
  • Another key field is OBJECT (along with sub-structure OBJECT_LIST) where it identifies the source object (be it an order, material or a cost center)


D) Identify cost components:

  • Use function module CKM8N_DOCUMENT_REPORT_CCS
    • Input: KALNR, Year, Period
    • Output: Individual documents posted in ML for given material in given year and period
  • Result of function module will have individual cost components


E) ML tables:

CKMLHD          Material Ledger: Header Record

CKMLCR          Material Ledger: Period Totals Records Values

CKMLKEPH        Material Ledger: Cost Component Split (Elements)

CKMLKALNR       Material Ledger: Cost Estimate Number Control

CKMLKEKO        Material Ledger: Cost Component Split (Header)

CKMLPP          Material Ledger Period Totals Records Quantity

CKMLPR          Material Ledger: Prices

CKMLPRKEPH    Material Ledger: Cost Component Split (Elements) for Prices

MLHD    Material Ledger Document: Header

MLIT      Material Ledger Document: Items

MLCD    Material Ledger: Summarization Record (from Documents)

CKMLMV001      Procurement alternatives

CKMLMV002      Assignments material / procurement alternatives


F) Special note:

  • As one can imagine, ML data can be huge and can pose a performance problem when being read for a custom report. Business users typically need the report output to be available within a reasonable time-frame – say 5-10 minutes. In such a scenario, it may be too cumbersome for the report to generate this data at run-time.
  • One approach to address this performance concern is:
    • Create a custom enhancement which will populate a custom table (kind of a staging area table) with all the summarized ML info. Summarization can be in the form:
      • Material, Plant (KALNR)
      • Year, Period
      • Process Category (field PTYP, data element CK_PTYP_BVALT)
      • Category (field CATEG, data element CKML_CATEG)
      • Consumed material (derived from Procurement Alternative)
    • The custom report can then pull data from this custom table.
    • The custom report will not fetch data from standard ML tables at run-time, but will fetch data from the pre-populated custom table.
    • One would de-risk the performance concern in this manner.
  • Proposed sequence at month-end:
    • CKMLCP – close Material Ledger for the given plants for the prior period
    • Custom enhancement will read ML data from standard ML tables, populate in custom table
    • Custom report will read data from custom table.