Posts

Showing posts with the label ABAP

CO-PA Derivation User Exit: What I_DERIVATION_DATE Contains for Actual and Plan Data

Image
In ECC 6.0 CO-PA characteristic derivation (KEDR), the user exit EXIT_SAPLKEDRCOPA_001 (include ZXKKEU11 ) receives a parameter called I_DERIVATION_DATE . This post records, with the ABAP debugger, which date arrives in that parameter for actual postings and which date arrives for plan data. Note: screen names, menu paths and settings can differ by SAP release and system configuration. The screenshots are from a Korean-language GUI. 1. What to check The line inside the user exit that builds a year+period key ( P_YMM ) from the derivation date: CONCATENATE I_DERIVATION_DATE(4) '0' I_DERIVATION_DATE+4(2) INTO P_YMM. Item Detail P_YMM format YYYY0MM (for example 2026009). Used as the lookup key against the period range (FJAHRPER to TJAHRPER) of a profit-center mapping table Question Which date does I_DERIVATION_DATE carry for an actual document, and which for plan data? 2. Actual postings KEDR → Derivation → Test. Enter a company code and ...

ZCO0042 — An ABAP Report That Unfolds CO Assessment Cycles (KSU1/KSU3) Including Allocation Structures

ZCO0042 is a custom ABAP report that unfolds the definition of CO actual assessment cycles (KSU1/KSU2/KSU3) into a single ALV grid. It is derived from ZCO0041, the sibling report for distribution cycles (KSV1/KSV3). The difference comes from what assessment does: it moves cost to a secondary cost element , so every segment carries either a single assessment cost element or an allocation structure , and the report shows that alongside the senders and receivers. In expanded mode, one row = segment × sender cost center × sender cost element × receiver × allocation-structure assignment . Selection screen The controlling area is pre-filled from the user parameter CAC (SU3) via MEMORY ID . The cycle F4 help cannot filter on T811C directly because that table has no KOKRS field; it goes through the cycle-level criteria in T811K ( SETKIND = '0' , FIELD = 'KOKRS' ) to restrict the list to the controlling area entered. The "only cycles with execution history" check...

ZCO0041 — An ABAP Report That Unfolds CO Distribution Cycles (KSV1/KSV3) into One Grid

ZCO0041 is a custom ABAP report that unfolds the definition of CO actual distribution cycles (KSV1/KSV2/KSV3) into a single ALV grid. In KSV3 you have to open a cycle and walk through five tabs per segment (Segment Header, Senders/Receivers, Sender Values, Receiver Tracing Factor, Receiver Weighting Factors); this report flattens all of that into rows you can scan at once — one row = segment × sender cost center × sender cost element × receiver . Selection screen The cycle F4 help is filtered by the controlling area entered on the screen (read at F4 time with DYNP_VALUES_READ , since PAI hasn't run yet). The "only cycles with execution history" checkbox is normally hidden — typing =A in the command field toggles it. Inputs starting with / are intercepted by the kernel as system commands, which is why = is used. Two output modes — summary and expansion A single checkbox ("expand sender/receiver groups and ranges") switches between two modes. Summary c...

Modern ABAP Syntax Notes — Patterns and Pitfalls from Real Development

ABAP syntax actually used while developing our custom Z reports, organized by topic. Examples come from working sources, together with the pitfalls we actually hit. Structure: syntax item → explanation → example code. Last updated: 2026-08-13 1. Data Declarations and Types ▷ Inline declarations DATA(...) / @DATA(...) — Declare and assign in one statement. SELECT result tables land directly in @DATA(lt_...) — the structure is derived from the SELECT list SELECT matnr, maktx FROM makt INTO TABLE @DATA(lt_makt) WHERE spras = @sy-langu. DATA(lv_qty) = ls_stpo-menge * iv_losgr / lv_bmeng. LOOP AT lt_mat INTO DATA(ls_mat). " loop variable inline too ENDLOOP. ▷ FIELD-SYMBOLS / ASSIGNING — Modify internal table rows in place without copying. ASSIGN COMPONENT lets you pick the column name at runtime (used for dynamic logic such as auto-hiding empty columns) LOOP AT gt_list ASSIGNING FIELD-SYMBOL(<ls_list>) WHERE typps = 'M'. <ls_list...

SAP Function Modules & Classes I Actually Use — By Purpose

Function modules (FMs) and classes actually used in our custom developments, organized by purpose. New entries are added whenever a new program is built. Each table: Object / Kind / Purpose / Programs using it. The notes record pitfalls we actually hit. Last updated: 2026-08-13 ALV / Screen Display Object Kind Purpose Used in REUSE_ALV_GRID_DISPLAY FM Classic ALV grid — the standard pattern of our reports ※ The essentials: box_fieldname (selection column), it_sort (sort/subtotals), cfieldname (currency) / qfieldname (unit) references — without the currency reference, KRW amounts display divided by 100 almost every Z report REUSE_ALV_COMMENTARY_WRITE FM TOP-OF-PAGE selection summary ※ SLIS_LISTHEADER-INFO is CHAR(60) — shorten long criteria almost every Z report CL_GUI_ALV_GRID Class OO ALV grid (needs a Custom Control screen) ※ When several grids share one event handler, tell them apart with the event's sender parameter ZJNC launchpad family ...

ABAP SELECT Patterns on S/4HANA — Real Queries from Working Reports

SELECT queries actually used in our custom Z reports, organized by use case. The code is taken verbatim from working sources. New cases are added whenever a new program is built. Each entry: Case / Explanation (+pitfalls) / The actual query. Last updated: 2026-08-13 CO — Standard Cost / Actuals — from ZCO0020 (standard cost vs actual) ▷ Standard cost header — latest released estimate (KEKO) — The latest released (FREIG='X') standard cost estimate (KALKA='01') by costing date (KADKY). SELECT SINGLE does not allow ORDER BY, so use UP TO 1 ROWS + ORDER BY instead SELECT kalnr, kalka, kadky, tvers, bwvar, losgr, meins FROM keko WHERE matnr = @iv_matnr AND werks = @p_werks AND kalka = '01' AND tvers = '01' AND freig = 'X' ORDER BY kadky DESCENDING INTO @DATA(ls_keko) UP TO 1 ROWS. ENDSELECT. ▷ Standard cost itemization (CKIS) — Explode the input lines using the estimate header keys (KALNR/KALKA/KADKY/TVERS...

SAP S/4HANA Table Reference — Tables I Actually Query, by Topic

SAP tables I actually queried while building custom reports and running end-to-end tests on an S/4HANA sandbox, grouped by topic. Updated continuously as development goes on. Each table: Table / Description / Key fields / T-codes / Used in our custom reports. Last updated: 2026-08-13 1. CO — Allocation Cycles (Assessment / Distribution) Table Description Key fields T-codes Used in our reports T811C Allocation cycle header ※ Distribution = ALART 'V', assessment = ALART 'U'. Classic CO-OM uses TAB='CCSS' TAB / CYCLE / SDATE KSU3, KSV3 ZCO0040 (allocation cycle report), ZCO0041 (distribution cycle detail) T811S Cycle segments ※ SRULE (sender rule) / RRULE (receiver rule) / SPERCENT / RCDATA (variable portion type) / NEGTEST (negative tracing factors — stored value differs from the screen code) TAB / CYCLE / SDATE / SEQNR KSU3, KSV3 ZCO0040, ZCO0041 T811K Selection criteria per segment ※ SETKIND: 0=cycle, 1=sender control, 2=sender, 3=rece...