Posts

Showing posts with the label Query

ECC G/L accounts, cost elements and the combined list: three Oracle SQL queries on SKA1/SKB1/CSKB

Three Oracle SQL queries for ECC: G/L accounts, cost elements, and the two combined. Each section goes query → result → notes. Unlike S/4HANA, ECC keeps G/L accounts (SKA1) and cost elements (CSKA/CSKB) as separate masters. SKA1 has no GLACCOUNT_TYPE field; whether an account is a cost element is decided by whether a CSKB row exists. Verified on IDES ECC 6.0 EhP7 / client 800 / company code 1000 (IDES AG, chart of accounts INT, EUR) / controlling area 1000 (CO Europe). The result values were read in SE16N. Replace the schema prefix SAPSR3 with the one on your system. 1. G/L accounts — query Case G/L accounts used by a company code (T001 + SKA1 + SKB1 + SKAT) What it does The chart-of-accounts master (SKA1) joined to the company code segment (SKB1) and the texts (SKAT). The INNER JOIN on SKB1 keeps only accounts that were actually extended to the company code. Result 1,400 rows for SKB1 BUKRS = 1000 (SE16N Number of Entries) SELECT t.BUKRS, t.KTOPL, LTRIM(a.SAKNR, ...

When was a CO-PA value field (VVxxx) created? HANA SQL in DB02 on DD03L/DD04L

Who created the CO-PA value fields (VV010, VV020, ...) and when. HANA SQL for DB02 → Diagnostics → SQL Editor. Verified on an S/4HANA sandbox (client 100, operating concerns OC10 and JNC2) on 2026-08-27. 0. Before you start — find the table that stores the value fields (CE1xxxx) Case Company code → controlling area → operating concern (TKA02 / TKA01) What it does Value fields (VVxxx) are created as columns of the operating concern line item table CE1<ERKRS>. Starting from the company code, TKA02 gives the controlling area (KOKRS) and TKA01 gives the operating concern (ERKRS), which names the table. Watch out On this system: CC10 → CA10 → OC10 (CE1OC10) and JNC2 → JNC2 → JNC2 (CE1JNC2). Each company code ends up in a different table. Result 2 rows (CC10 → OC10, JNC2 → JNC2) SELECT k.BUKRS, k.KOKRS, a.ERKRS FROM TKA02 k INNER JOIN TKA01 a ON a.MANDT = k.MANDT AND a.KOKRS = k.KOKRS WHERE k.MANDT = '100' AND k.BUKRS IN ('CC10', 'JNC2') ...

CO-PA characteristics and value fields by operating concern: HANA SQL in DB02/ST04 (TKEFE/TKEF/TKEB)

Which characteristics and value fields are assigned to an operating concern — read from TKEFE and TKEF instead of clicking through KEA0. HANA SQL for DB02/ST04 → SQL Editor. Verified on the EWM system (client 700, operating concerns OC10–OC40) on 2026-08-28. 0. Before you start — the operating concerns on the system (TKEB) Case List of operating concerns (TKEB) What it does TKEB is the client-dependent operating concern table. Currency (WAERS), fiscal year variant (PERIV) and creation date (CREDA) come with it. Watch out TKEB has MANDT — a client condition is required in the WHERE clause. Result 10 rows — OC10 / OC20 / OC30 / OC40 (KRW, created in 2026) plus the standard samples 1010 (empty entry), E_B1, S001, S_AL, S_CP, S_GO SELECT ERKRS, WAERS, PERIV, CREDA FROM TKEB WHERE MANDT = '700' ORDER BY ERKRS; 1. Characteristics and value fields (TKEFE × TKEF) Case Characteristics and value fields per operating concern (TKEFE × TKEF) What it does TKEFE lists the fields ...

CO-PA transfer structure (KEI1) in HANA SQL and ABAP SQL: TKB9C/TKB9G/TKB9F, plus cost element group expansion

The PA transfer structure (KEI1) — its assignment lines, the source cost elements and the value field assignments — read straight from the tables. HANA SQL for DB02/ST04 → SQL Editor. Sections 1–2 were verified on the EWM system (client 700, transfer structure FI, controlling area CA10) on 2026-08-28. Sections 3–5 were added on 2026-08-31 and verified on an S/4HANA sandbox (client 100, transfer structure FI, controlling area 0001). 1. Assignment lines (TKB9C × TKB9D) Case Assignment lines of a transfer structure (TKB9C × TKB9D) What it does TKB9C holds the assignment lines (ERZUO), TKB9D the line texts. FAKMG = 'X' corresponds to the Qty billed/delivered checkbox in KEI1. The output is the left-hand list of the KEI1 screen. Watch out The transfer structure header is TKB9A and its text is TKB9B. All TKB9* tables are client-dependent (they have MANDT). Result 3 rows — 010 Salary, 020 Depreciation, 030 IO Salary (same as the KEI1 screen) SELECT c.ERSCH, c.ERZUO, d.ZTEXT, c.F...

Cost centers by controlling area with every CSKS/CSKT column: HANA SQL in DB02/ST04 (S/4HANA and ECC versions)

Give it a controlling area (KOKRS) and it returns every cost center underneath with all CSKS columns, plus the names from CSKT. Plain HANA SQL for DB02/ST04 → Diagnostics → SQL Editor; an S/4HANA version and an ECC version are both included. Verified on an S/4HANA sandbox: controlling area JNC2 (JNC #2 Controlling Area), client 100. Written 2026-08-31. 1. Result — 5 cost centers in JNC2 Case Cost centers under controlling area JNC2 (output of the query in section 6) What it does The five cost centers of JNC2 with the CSKT name, category, functional area and standard hierarchy node. The full query returns all 84 CSKS columns; the grid below shows the columns that carry the meaning. Result 5 rows Result — 5 rows (KOKRS = JNC2) KOSTL | KTEXT (CSKT) | KOSAR | FUNC_AREA | KHINR (std hierarchy node) ---------+------------------------+-------+----------------------+--------------------------- JNC21010 | SG&A | 2 | JNCS (SG&A) ...

Standard Cost Marking and Release Status — Reading It Straight from KEKO, MBEW and MBEWH

If you run a standard cost estimate every month, sooner or later someone asks a question no single SAP screen answers well: which materials were only marked, which were actually released, and when? Opening CK11N or CK24 material by material is not an answer when there are hundreds of them. Three tables carry the whole story — KEKO , MBEW and MBEWH . Below are the queries I use to read status, monthly trend and missed releases straight out of them, in ABAP SQL and in native HANA SQL for the DB02 SQL editor. The three states of a cost estimate Estimating, marking and releasing are three separate acts, and each leaves its trace in a different field. Getting that mapping right is most of the job: Status How it is recognised What it means ESTIMATED_ONLY FREIG ≠ 'X', VORMDAT = 00000000 The estimate was run (CK11N/CK40N) and nothing else happened. The material master still carries the old price. MARKED_NOT_RELEASED FREIG ≠ 'X', VORMDAT > 00000000 Marked (CK24 marking...