SAP Time Slicing

Filter SAP data by date ranges to control data volume and create focused test datasets.

Overview

Time slicing allows you to extract a subset of SAP data based on date fields:

  • Master Data - Filtered by creation date (ERSDA)

  • Transactional Data - Filtered by posting/document date (BUDAT)

This enables you to create smaller, more relevant test datasets from large SAP systems.

How Time Slicing Works

Date Fields Used

Data Type Date Field Description

Master Data

ERSDA

Creation date of the master record

Transactional Data

BUDAT

Posting/booking date of the document

Filter Logic

The platform generates SQL filters using SAP HANA date functions:

-- Master data: records created in last 3 months
WHERE ERSDA >= ADD_MONTHS(CURRENT_DATE, -3)

-- Transactional data: documents posted in last 3 months
WHERE BUDAT >= ADD_MONTHS(CURRENT_DATE, -3)

Available Time Periods

Option Months Use Case

No time slicing

All data

Complete historical dataset

Last month

1

Very recent data only

Last 3 months

3

Current quarter data

Last 6 months

6

Half-year data

Last 9 months

9

Three-quarter year data

Last 12 months

12

Full year data

Generated Configuration

Master Data Filter

tables:
  - table_name_with_schema: "SCHEMA.MARA"
    filter: "ERSDA >= ADD_MONTHS(CURRENT_DATE, -3)"
    transformations:
      - columns: ["MANDT"]
        params:
          type: passthrough
      # ...

Transactional Data Filter

tables:
  - table_name_with_schema: "SCHEMA.MKPF"
    filter: "BUDAT >= ADD_MONTHS(CURRENT_DATE, -3)"
    transformations:
      - columns: ["MANDT"]
        params:
          type: passthrough
      # ...

Referential Integrity

When using transactional data with time slicing, the platform ensures master data referenced by transactions is included:

Scenario: 3-month time slice

Transaction (MSEG) - Created: 2024-01-15
    ↓ References MATNR = 'MAT-001'

Master Record (MARA) - Created: 2020-06-01
    ↓ Created 3+ years ago, but STILL INCLUDED
    ↓ because it's referenced by a transaction within the time window

How It Works

  1. Transactional Filter Applied - Only documents within the time period

  2. Reference Analysis - Identify master records referenced by included transactions

  3. Master Data Expansion - Include referenced master records regardless of creation date

  4. Consistency Maintained - All foreign key references resolve correctly

Time Slicing with Full Copy

Optional Date Filtering

When "Full Copy" data scope is selected, time slicing can still be applied to filter by date when needed. Without a time slice, all records are included:

# Full Copy without time slicing - all records
tables:
  - table_name_with_schema: "SCHEMA.MARA"
    # No filter property - all records included

# Full Copy with optional time slicing
tables:
  - table_name_with_schema: "SCHEMA.MARA"
    filter: "ERSDA >= ADD_MONTHS(CURRENT_DATE, -6)"  # Optional date filter

Master Data Only Scope

With "Master Data Only" scope, time slicing filters by creation date:

  • Recently created materials are included

  • Old materials may be excluded

  • Consider implications for dependent data

Choosing the Right Time Period

Considerations

Factor Guidance

Test Scenario

Match the time period to your test requirements. Testing month-end close? Use last month.

Data Volume

Longer periods = more data. Start small, increase if needed.

Processing Time

Longer periods increase workflow execution time.

Storage Requirements

Target database must accommodate the selected volume.

Business Seasonality

Ensure the period captures representative business activity.

Environment Recommendations

Environment Recommended Period Rationale

Development

Last month or 3 months

Quick iterations, minimal data needed

CI/CD Pipelines

Last month

Fast execution, frequent runs

System Testing

Last 3-6 months

Representative data variety

UAT

Last 6-12 months

Cover more scenarios

Performance Testing

Last 12 months or Full Copy

Realistic data volumes

Production Clone

Full Copy (no slicing)

Complete replica

Estimating Data Volume

Before selecting a time period, estimate the data volume:

-- Transactional data by month
SELECT
    YEAR(BUDAT) AS year,
    MONTH(BUDAT) AS month,
    COUNT(*) AS document_count
FROM SCHEMA.MKPF
WHERE BUDAT >= ADD_MONTHS(CURRENT_DATE, -12)
GROUP BY YEAR(BUDAT), MONTH(BUDAT)
ORDER BY year DESC, month DESC;

-- Master data by creation month
SELECT
    YEAR(ERSDA) AS year,
    MONTH(ERSDA) AS month,
    COUNT(*) AS record_count
FROM SCHEMA.MARA
WHERE ERSDA >= ADD_MONTHS(CURRENT_DATE, -12)
GROUP BY YEAR(ERSDA), MONTH(ERSDA)
ORDER BY year DESC, month DESC;

Custom Date Filters

For advanced scenarios requiring custom date logic, you can manually edit the workflow configuration:

tables:
  - table_name_with_schema: "SCHEMA.MKPF"
    # Custom filter: specific date range
    filter: "BUDAT BETWEEN '2024-01-01' AND '2024-03-31'"

  - table_name_with_schema: "SCHEMA.MARA"
    # Custom filter: exclude specific material types
    filter: "ERSDA >= ADD_MONTHS(CURRENT_DATE, -6) AND MTART != 'SERV'"

Custom filters require editing the YAML configuration directly after the wizard generates the initial workflow.

Troubleshooting

No Data Returned

If the workflow completes but no data is copied:

  1. Check Date Field Values - Verify ERSDA/BUDAT contain expected dates

  2. Validate Date Format - SAP stores dates in various formats

  3. Extend Time Period - Try a longer time slice

-- Verify date field values
SELECT MIN(ERSDA), MAX(ERSDA), COUNT(*) FROM SCHEMA.MARA;
SELECT MIN(BUDAT), MAX(BUDAT), COUNT(*) FROM SCHEMA.MKPF;

Missing Master Data

If transactions reference materials not in the output:

  1. Check Referential Integrity - Ensure master data expansion is working

  2. Verify Join Conditions - Confirm MATNR values match between tables

  3. Review Filter Logic - Time slice may be too restrictive

Performance Issues

For large time periods:

  • Consider running during off-peak hours

  • Monitor SAP HANA resource usage

  • Split into multiple workflows if needed