Transformations
BW / Analyticsbeginner

Understanding BW Transformations: Purpose and Core Concepts

Introduces what a BW transformation is, why it exists in the data flow, and the basic rule types used to map and convert fields between source and target objects.

Explanation

A transformation in SAP BW is the object that sits between a source (a DataSource, InfoSource, or another InfoProvider) and a target (a DataStore Object, InfoObject, or InfoProvider) and defines exactly how each field of incoming data is converted, mapped, or calculated before it lands in the target. Before transformations existed as a unified object (in older BW releases update rules and transfer rules were separate), the modern transformation concept unifies mapping logic into a single object with a graphical rule editor. This matters because raw data arriving from a source system rarely matches the target's structure, data types, units of measure, or business semantics exactly. A sales order extractor might deliver quantities in the source system's base unit, dates in a different format, or currency amounts that need conversion to a reporting currency. Without a transformation layer, this reconciliation would have to happen ad hoc in queries, which is inefficient and inconsistent. Every transformation consists of rule groups, and within each rule group there are individual field-level rules. The most common rule types are: direct assignment (source field maps straight to target field with no change), constant (target field is always populated with a fixed value), formula (a simple built-in function like concatenation, arithmetic, or date calculations), and routine (custom ABAP code for complex logic that formulas cannot express). There is also a special rule type called 'no transformation' which explicitly excludes a field from being populated, and read master data rules, which pull an attribute of an existing master data object into the target during the load. Structurally, a transformation always has a source structure and a target structure displayed side by side in the transformation maintenance tool. You draw or assign rules connecting source fields to target fields. Key figures typically get aggregation behavior defined (summation, overwrite, minimum, maximum), while characteristics usually get direct or routine-based mapping. Time characteristics often need special handling because source systems store dates differently than BW's internal calendar characteristics (0CALDAY, 0CALMONTH, 0FISCPER, etc.), so BW provides built-in time conversion rule types for this. In terms of runtime behavior, when a Data Transfer Process (DTP) executes, it reads data from the source, applies the transformation rule by rule for every record and every field, and writes the transformed result to the target's activation queue (for DSOs) or directly to the fact table structures (for InfoCubes, though modern BW/4HANA strongly favors ADSOs). If a transformation contains a start routine or end routine, these execute once per data package, allowing bulk operations like deleting duplicate records or applying package-level aggregation logic before or after individual field rules run. For a beginner, the most important mental model is: transformation = the rulebook, DTP = the engine that executes the rulebook against a specific request of data. You cannot load data without both existing in a properly activated state. If a transformation is inconsistent (for example, referencing a deleted InfoObject), the DTP will fail to activate or will error out at execution time. Across deployment types, the core rule-type concepts are consistent, but BW/4HANA has simplified the object model by removing legacy InfoCube-based transfer/update rule concepts entirely and standardizing on ADSOs, which changes some default rule suggestions (e.g., BW/4HANA proposes fewer legacy time-conversion quirks tied to old InfoCube fact tables). In S/4HANA embedded analytics scenarios using CDS-based virtual data models, transformations in the classical BW sense are largely bypassed in favor of view-based semantics, so this topic specifically applies to scenarios where physical data persistence and ETL-style movement into BW objects is still required.

Code example

ABAP Code
* Example: Simple end routine in a transformation* Purpose: remove test records (customer 'TEST99') after field rules have run* This runs once per data package, not per record METHOD end_routine.  DATA: ls_result TYPE tys_TG_1.   DELETE RESULT_PACKAGE WHERE customer = 'TEST99'.   IF sy-subrc = 0.    MESSAGE 'Test customer records removed from package' TYPE 'I'.  ENDIF. ENDMETHOD.

Real project scenario

A retail company loads daily sales data from an ECC source system into a DSO. The functional consultant notices that test transactions created by the QA team during integration testing (customer code TEST99) are appearing in production reports after a data refresh mistake. Rather than manually deleting records after each load, the BW developer adds an end routine to the transformation between the DataSource and the DSO that filters out any record where the customer field equals TEST99, ensuring these records never reach the target table regardless of who runs the load.

Common mistakes

โ€ข Assuming a transformation automatically handles unit and currency conversion without an explicit formula or routine rule โ€ข Forgetting that constant rules overwrite the field every single load, which can silently erase previously loaded distinguishing values if misapplied โ€ข Not activating the transformation after changes, leading to DTP execution using stale logic โ€ข Confusing start routines (run once before field rules, per package) with end routines (run once after field rules, per package) โ€ข Mapping time characteristics with direct assignment instead of using the provided time conversion rule type, causing incorrect period values

Best practices

โ€ข Use formula rules instead of routines whenever the logic is simple enough, for better performance and easier maintenance โ€ข Document any ABAP routine with inline comments explaining business logic, since routines are the hardest thing to reverse-engineer later โ€ข Keep start routines focused on package-level filtering or restructuring, not per-record business logic better suited to field rules โ€ข Always test transformation changes in a development system with a representative data sample before promoting to production โ€ข Name transformations and their rule groups descriptively when multiple rule groups exist for different source system scenarios

Interview angle

Interviewers commonly ask candidates to explain the difference between a formula rule and a routine rule, and when each is appropriate. A strong answer highlights that formulas are declarative, reusable, and performance-friendly for simple logic, while routines are necessary for multi-field conditional logic, external table lookups, or loops, but carry higher maintenance and performance cost. Being able to describe start vs end routine execution scope (package-level, not record-level) is also a frequent differentiator between junior and mid-level candidates.