# SAP Data Scoping

> Source: https://docs.synthesized.io/tdk/latest/user_guide/070_integrations/sap/data_scoping
> For the complete documentation index, see [llms.txt](https://docs.synthesized.io/llms.txt).

Control the scope of data included in SAP workflows by selecting master data, transactional data, or complete datasets.

## Overview

SAP data can be categorized into two main types:

- **Master Data** - Reference data that changes infrequently (materials, vendors, customers)
- **Transactional Data** - Operational data created by business processes (documents, postings)

The platform allows you to choose which data types to include based on your testing needs.

## Scope Options

### Master Data Only

**Includes:** Reference tables only **Excludes:** All transactional/document tables

#### MM Module Tables Included

 
| Table | Description |
| --- | --- |
| 
MARA

 | 

Material Master - General Data

 |
| 

MAKT

 | 

Material Descriptions

 |
| 

MARC

 | 

Material Master - Plant Data

 |
| 

MARD

 | 

Material Master - Storage Location Stock

 |
| 

MBEW

 | 

Material Valuation Data

 |
| 

MARM

 | 

Material Units of Measure

 |
| 

MVKE

 | 

Material Sales Data

 |

#### When to Use

- **Development environments** - Testing basic application functionality
- **Reference data refresh** - Updating master data without transactions
- **Smaller test datasets** - Faster provisioning for CI/CD pipelines
- **Integration testing** - Validating master data lookups

#### Configuration

```yaml
# Generated for Master Data scope
tables:
  - table_name_with_schema: "SCHEMA.MARA"
    transformations:
      # Master data transformations
  - table_name_with_schema: "SCHEMA.MAKT"
    transformations:
      # Description transformations
  # ... other master tables only
```

### Transactional + Master Data

**Includes:** Both master and transactional tables **Behavior:** Automatically includes master data referenced by transactions

#### MM Module Tables Included

  
| Table | Description | Type |
| --- | --- | --- |
| 
MARA

 | 

Material Master - General Data

 | 

Master

 |
| 

MAKT

 | 

Material Descriptions

 | 

Master

 |
| 

MARC

 | 

Material Master - Plant Data

 | 

Master

 |
| 

MARD

 | 

Material Master - Storage Location Stock

 | 

Master

 |
| 

MBEW

 | 

Material Valuation Data

 | 

Master

 |
| 

MARM

 | 

Material Units of Measure

 | 

Master

 |
| 

MVKE

 | 

Material Sales Data

 | 

Master

 |
| 

MKPF

 | 

Material Document Header

 | 

Transactional

 |
| 

MSEG

 | 

Material Document Item

 | 

Transactional

 |

#### Automatic Master Data Inclusion

When selecting transactional data, the platform ensures referential integrity:

```
Transactional Record (MSEG)
    ↓ References MATNR
Master Record (MARA)
    ↓ Automatically included even if created before time period
```

**Example:** A material document from last month references a material created 2 years ago. The material master record is included to maintain data consistency.

#### When to Use

- **Realistic test data** - Complete business scenarios with documents
- **Process testing** - Testing workflows that create/modify documents
- **UAT environments** - User acceptance testing with real transactions
- **Performance testing** - Testing with realistic data volumes

#### Configuration

```yaml
# Generated for Transactional scope with 3-month filter
tables:
  # Master data - filtered by creation date
  - table_name_with_schema: "SCHEMA.MARA"
    filter: "ERSDA >= ADD_MONTHS(CURRENT_DATE, -3)"
    transformations:
      # ...

  # Transactional data - filtered by posting date
  - table_name_with_schema: "SCHEMA.MKPF"
    filter: "BUDAT >= ADD_MONTHS(CURRENT_DATE, -3)"
    transformations:
      # ...

  - table_name_with_schema: "SCHEMA.MSEG"
    transformations:
      # Linked to MKPF, inherits filter
```

### Full Copy

**Includes:** All master data and transactional tables **Use case:** Complete dataset replication for environments requiring full data history

#### Characteristics

- Includes all historical records
- Can be combined with time slicing when date-based filtering is needed
- Table truncation mode typically set to `DO_NOT_TRUNCATE` for additive loads
- Largest data volume

#### When to Use

- **Complete test environments** - Exact replica of production
- **Historical analysis** - Testing with full data history
- **Migration testing** - Validating data migration processes
- **Performance baselines** - Measuring against full data volume

#### Configuration

```yaml
# Generated for Full Copy scope
table_truncation_mode: DO_NOT_TRUNCATE

tables:
  - table_name_with_schema: "SCHEMA.MARA"
    # No filter - all records included
    transformations:
      # ...

  - table_name_with_schema: "SCHEMA.MKPF"
    # No filter - all documents included
    transformations:
      # ...
```

## Scope Comparison

   
| Aspect | Master Only | Transactional | Full Copy |
| --- | --- | --- | --- |
| 
**Master Tables**

 | 

Yes

 | 

Yes

 | 

Yes

 |
| 

**Transaction Tables**

 | 

No

 | 

Yes

 | 

Yes

 |
| 

**Time Slicing**

 | 

Optional

 | 

Available

 | 

Available

 |
| 

**Relative Size**

 | 

Small

 | 

Medium

 | 

Large

 |
| 

**Use Case**

 | 

Development

 | 

Testing

 | 

Production Clone

 |

## Data Volume Considerations

### Estimating Data Volume

Use these queries to estimate row counts before running workflows:

```sql
-- Master data count
SELECT 'MARA' AS table_name, COUNT(*) AS row_count FROM SCHEMA.MARA
UNION ALL
SELECT 'MAKT', COUNT(*) FROM SCHEMA.MAKT
UNION ALL
SELECT 'MARC', COUNT(*) FROM SCHEMA.MARC;

-- Transactional data by date range
SELECT
    'MKPF' AS table_name,
    COUNT(*) AS total_rows,
    COUNT(CASE WHEN BUDAT >= ADD_MONTHS(CURRENT_DATE, -3) THEN 1 END) AS last_3_months
FROM SCHEMA.MKPF;
```

### Performance Impact

  
| Scope | Typical Duration | Memory Usage |
| --- | --- | --- |
| 
Master Only

 | 

Minutes

 | 

Low

 |
| 

Transactional (3 months)

 | 

10-30 minutes

 | 

Medium

 |
| 

Full Copy

 | 

Hours

 | 

High

 |

## Combining Scope with Time Slicing

The scope selection interacts with time slicing:

  
| Scope | Time Slicing | Behavior |
| --- | --- | --- |
| 
Master Only

 | 

Available

 | 

Filters master data by creation date (ERSDA)

 |
| 

Transactional

 | 

Available

 | 

Filters transactions by posting date (BUDAT)

 |
| 

Full Copy

 | 

Available

 | 

Filters by date when configured; includes all records when not specified

 |

[Learn more about Time Slicing →](https://docs.synthesized.io/tdk/latest/user_guide/070_integrations/sap/time_slicing)

## Best Practices

### Start Small, Expand Later

1. Begin with **Master Data Only** to validate setup
2. Add **Transactional + 3 months** for realistic testing
3. Use **Full Copy** only when complete data is required

### Match Scope to Environment

 
| Environment | Recommended Scope |
| --- | --- |
| 
Development

 | 

Master Only

 |
| 

System Testing

 | 

Transactional (3-6 months)

 |
| 

UAT

 | 

Transactional (6-12 months)

 |
| 

Performance Testing

 | 

Full Copy or Transactional (12 months)

 |
| 

Production Clone

 | 

Full Copy

 |

### Consider Storage Requirements

Full Copy can require significant storage. Plan target database sizing accordingly:

```sql
-- Estimate storage for MM tables
SELECT
    TABLE_NAME,
    ROUND(TABLE_SIZE / 1024 / 1024, 2) AS SIZE_MB
FROM M_TABLES
WHERE SCHEMA_NAME = 'SCHEMA'
    AND TABLE_NAME IN ('MARA', 'MAKT', 'MARC', 'MARD', 'MKPF', 'MSEG')
ORDER BY TABLE_SIZE DESC;
```

## See Also

- [Time Slicing](https://docs.synthesized.io/tdk/latest/user_guide/070_integrations/sap/time_slicing)
- [SAP Modules](https://docs.synthesized.io/tdk/latest/user_guide/070_integrations/sap/modules)
- [SAP Workflow Wizard](https://docs.synthesized.io/tdk/latest/user_guide/070_integrations/sap/workflow_wizard)
