ERPClimb logoERPClimb
Transformations
BW / Analyticsintermediate 8 min read

Using Start, End, and Expert Routines for Custom Transformation Logic (Part 3)

Preview · a free account unlocks the full lesson

Key takeaway

Learn how to implement ABAP-based start routines, end routines, and expert routines in BW transformations to handle logic that field-level rules cannot express, including package-level filtering, lookups, and record consolidation.

In this lessonShow sections

Visual overview

Using Start, End, and Expert Routines for Custom Transformation Logic (Part 3) — learning sheetIn one line: Learn how to implement ABAP-based start routines, end routines, and expert routines in BW transformations to handle logic that field-level rules cannot express, including package-level filtering, lookups, and record consolidation.ERPClimb.com / BW / LESSON 3/4 / LEARNING SHEETUsing Start, End, and Expert Routines for CustomTransformation Logic (Part 3)1 · IN ONE LINELearn how to implement ABAP-based start routines, end routines, and expert routines in BWtransformations to handle logic that field-level rules cannot express, includingpackage-level filtering, lookups, and record consolidation.2 · KEY IDEAS EXPLAINED1Standard field-level rule types in a BWtransformation (direct assignment, constant,formula, read master data) cover most mappingneeds, but many real transformations require logicthat spans multiple records in the transferpackage, needs external lookups against master…2Design discipline matters here. Start routines arethe right place to do package-wide operationsonce, such as selecting master data texts orexchange rates for the whole package into aninternal table, rather than issuing a databaseread for every single record in a field routine…3End routines are commonly used to eliminateduplicate keys before they are written to aDataStore object with overwrite semantics, to netvalues across split source lines, or to applycurrency translation types that depend on thefully mapped record. Because the end routine works…4Expert routines exist for edge cases:source-to-target cardinality that changesdynamically, complex looping logic that cannot beexpressed as a chain of start/field/end routines,or migration scenarios copying legacy custom ABAPlogic wholesale. They should be used sparingly…3 · DO · AVOIDBest practice!Common mistakePerform bulk data reads (master data, DSOlookups) once per package in the start…Reserve expert routines for logic thatgenuinely cannot be decomposed into…Use end routines to deduplicate, consolidate,or apply record-spanning business rules after…✕Performing database SELECTs inside field-levelroutines that execute once per record instead…✕Using an expert routine to solve a problemthat could be cleanly expressed with standard…✕Not initializing or resetting global classattributes between package executions, causing…4 · IN A REAL PROJECTA retail customer's sales DataStore object load was timing out during month-end because a field routineperformed a database SELECT SINGLE against a master data attribute table for every one of several hundredthousand records in each package. The consulting team refactored the logic: a start routine now performs one…Original ERPClimb learning sheet • Verify against your SAP release and edition

Explanation

Standard field-level rule types in a BW transformation (direct assignment, constant, formula, read master data) cover most mapping needs, but many real transformations require logic that spans multiple records in the transfer package, needs external lookups against master data or other DataStore objects, or must aggregate/split records conditionally. This is where routines come in.

A start routine executes once per data package before field-level rules run; it receives an internal table of source records (SOURCE_PACKAGE) that you can modify, delete rows from, or use to build lookup tables for later field routines. An end routine executes once per package after field-level mapping, operating on the result package (RESULT_PACKAGE) structured like the target; this is the natural place to consolidate duplicate keys, apply final business rules, or delete records that fail late-stage validation.

An expert routine replaces the entire transformation for a rule group, giving full control over both source and result packages, but it forfeits the maintainability of individual field rules, so it is reserved for genuinely complex, non-decomposable logic.

Design discipline matters here. Start routines are the right place to do package-wide operations once, such as selecting master data texts or exchange rates for the whole package into an internal table, rather than issuing a database read for every single record in a field routine (which is a classic performance anti-pattern).

Free account

Create a free account to keep reading

You have read the opening of this lesson. A free ERPClimb account unlocks the rest of it, every other lesson and topic, and your learning history, so you can pick up exactly where you stopped. No card needed.

  • Full explanation
  • Code example
  • Real project scenario
  • Common mistakes
  • Best practices
  • Interview angle

One tap with Google works too. Every topic keeps its first lesson open to everyone.

Keep exploring

Check before use: lesson examples are educational, not a guarantee of correctness for your SAP edition or release. Sample code has not been executed on your SAP system. Confirm API availability, syntax, authorizations and business impact in an approved development or test environment.