Skip to main content

Module 6: Transformations and Field Mapping

Learn how to transform data during replication - field mapping, calculations, filtering, and data enrichment.

1. Transformation Overview

SLT supports three transformation types:

  • Field-level mapping (rename, reorder)
  • Value transformations (calculations, conversions)
  • Row-level filtering (conditional replication)

Transformation Architecture

graph LR
A[Source Data] --> B[Read]
B --> C{Transformation<br/>Rules}
C --> D[Field Mapping]
C --> E[Calculations]
C --> F[Filtering]
D --> G[Target Data]
E --> G
F --> G

2. Field Mapping

Simple Field Mapping

Transaction: LTRC → Transformations

Source Table: MARA
Target Table: SLTREPL.MARA

Field Mappings:
MATNR → MATERIAL_NUMBER (rename)
MTART → MATERIAL_TYPE
MATKL → MATERIAL_GROUP
MEINS → BASE_UOM
(skip NTGEW, BRGEW) (exclude fields)

Mapping Types

TypeExampleUse Case
DirectMATNR → MATNRNo change
RenameMATNR → MAT_NOField name change
ConstantNULL → 'DEFAULT'Add default values
ConcatenateVBELN+POSNR → ORDER_ITEMCombine fields
SplitKUNNR → CUST_ID, CUST_TYPEDivide field

3. Value Transformations

Built-in Functions

Transformation Expression Examples:

1. Date Conversion:
ERDAT → TO_DATE(ERDAT, 'YYYYMMDD')

2. Unit Conversion:
NTGEW → NTGEW * 1000 (KG to G)

3. Currency Conversion:
NETWR → NETWR * EXCHANGE_RATE

4. String Manipulation:
MATNR → LTRIM(MATNR, '0') (remove leading zeros)

5. Conditional Logic:
IF MTART = 'FERT' THEN 'FINISHED' ELSE 'OTHER'

Custom ABAP Routines

" Create custom transformation routine
FUNCTION Z_TRANSFORM_MATERIAL.
IMPORTING
iv_matnr TYPE matnr
EXPORTING
ev_material_id TYPE string.

" Remove leading zeros and add prefix
ev_material_id = 'MAT-' && |{ iv_matnr ALPHA = OUT }|.
ENDFUNCTION.

4. Filtering Rules

Row-Level Filtering

-- Only replicate materials created this year
WHERE ERDAT >= '20260101'

-- Only specific material types
WHERE MTART IN ('FERT', 'HALB', 'ROH')

-- Complex conditions
WHERE (MTART = 'FERT' OR MTART = 'HALB')
AND LVORM = ''
AND ERDAT >= '20240101'

Performance Impact

No Filter:    1,000,000 rows → 100% replicated
Date Filter: 500,000 rows → 50% replicated (50% savings)
Type Filter: 200,000 rows → 20% replicated (80% savings)

5. Configuration Steps

Step 1: Access Transformation Designer

Transaction: LTRC
Select MT_ID: ECC_HANA_01
Tab: Tables → Select MARA
Button: [Configure Transformations]

Step 2: Define Field Mappings

Source Field → Target Field → Transformation

MATNR → MATERIAL_NO → LTRIM(MATNR, '0')
MTART → MAT_TYPE → <direct>
MATKL → MAT_GROUP → <direct>
MEINS → UOM → <direct>
CREATED_BY → <NEW> → CURRENT_USER (constant)

Step 3: Test Transformations

-- Test with sample data
Test Input:
MATNR: '000000000012345'
MTART: 'FERT'

Expected Output:
MATERIAL_NO: '12345'
MAT_TYPE: 'FERT'
CREATED_BY: 'SLTUSER'

[Execute Test] → ✅ Passed

6. Advanced Scenarios

Scenario 1: Data Enrichment

Enrich customer data with region lookup:

Source: KNA1 (Customer)
Lookup: T005 (Countries)
Target: Enriched customer with region

Transformation:
1. Read KNA1.LAND1 (country)
2. Lookup T005.REGION for LAND1
3. Add REGION to target record

Scenario 2: Multi-Table Join

-- Combine order header + item data
SELECT
VBAK.VBELN,
VBAK.KUNNR,
VBAP.POSNR,
VBAP.MATNR,
VBAP.KWMENG
FROM VBAK
INNER JOIN VBAP ON VBAK.VBELN = VBAP.VBELN
WHERE VBAK.ERDAT >= '20260101'

Scenario 3: Data Masking (Privacy)

Mask sensitive data:

Original: KUNNR = 'CUST-123456'
Masked: KUNNR = 'CUST-XXXXXX'

Original: EMAIL = 'john.doe@company.com'
Masked: EMAIL = 'xxxx.xxx@company.com'

7. Performance Considerations

Transformation Impact

ComplexityPerformance ImpactLatency Increase
None0%+0 ms
Simple (rename)1-2%+10 ms
Calculations5-10%+50 ms
Lookups20-30%+200 ms
Complex ABAP50-100%+500 ms

Optimization Tips

✅ Push transformations to target (HANA views) ✅ Minimize complex calculations ✅ Cache lookup tables ✅ Use parallel processing for heavy transforms ✅ Monitor transformation time per table

8. Troubleshooting

Common Issues

Issue 1: Transformation Syntax Error

Error: Invalid expression 'MATNR + WERKS'
Solution: Use concatenation: MATNR || WERKS

Issue 2: Data Type Mismatch

Error: Cannot convert CHAR to INT
Solution: Add explicit cast: TO_INTEGER(MATNR)

Issue 3: Lookup Table Not Found

Error: Table T005 not replicated
Solution: Add T005 to MT_ID or use alternative

Summary

✅ Field mapping and renaming
✅ Value transformations and calculations
✅ Row-level filtering
✅ Custom ABAP routines
✅ Advanced scenarios (enrichment, joins, masking)
✅ Performance optimization
✅ Troubleshooting transformations

Next: Module 7 - Monitoring and Logging