Filtering
Tracelake supports two levels of filtering to reduce data scope and improve validation performance:
Global Client Filtering
Client filtering applies to all tables in a validation plan that have SAP client fields (MANDT, RCLNT, or CLNT).
You can setup a client filter in the Plan settings.
For example, if you are only replicating data from client 100, you can setup the client filter as follows:
Table-Level Filtering
Table-level filters allow you to specify custom WHERE clause conditions for individual tables. This is particularly useful for:
- Large table optimization: Limit validation to recent or relevant data
- Cost reduction: Process fewer rows to reduce usage billing
- Performance improvement: Faster execution with smaller datasets
- Targeted validation: Focus on specific business scenarios
Configuring Table Filters
- Navigate to your validation plan
- Go to the Tables tab
- Click Manage Tables
- In the Filter Conditions column, enter your WHERE clause condition
- Save your changes
Filter Examples
Time-Based Filtering (Common for SAP)
-- Fiscal year filteringGJAHR >= '2023'GJAHR = '2024'CALYEAR >= '2023' AND CALYEAR <= '2024'
-- Date-based filteringCREATED_DATE > '2024-01-01'POSTING_DATE >= '2023-01-01'
Organizational Filtering
-- Company code filteringBUKRS = 'US01'BUKRS IN ('US01', 'DE01', 'UK01')RBUKRS = '1000'
-- Plant or location filteringWERKS = '1000'LGORT IN ('0001', '0002')
Document-Specific Filtering
-- Specific document typesDOCTYP = 'SA'BSTAT = 'REL'
-- Document number rangesBELNR LIKE 'SA%'VBELN >= '0000100000'
Complex Conditions
-- Multiple criteriaGJAHR >= '2023' AND BUKRS = 'US01'(CALYEAR >= '2023' OR PRIORITY = 'HIGH') AND STATUS = 'ACTIVE'
-- Exclude certain valuesBUKRS != 'TEST' AND GJAHR >= '2023'DOCTYP NOT IN ('TEST', 'TEMP')
Security and Validation
Tracelake automatically validates filter conditions for security:
- SQL injection prevention: Dangerous keywords (DROP, DELETE, etc.) are blocked
- Syntax validation: Checks for balanced parentheses and proper formatting
- No WHERE keyword: Don’t include “WHERE” - it’s added automatically
- Semicolon protection: Multiple statements are prevented
How Filters Work
When validation runs, filters are combined using AND logic:
-- Example with both global client filter and table filterWHERE MANDT = '100' AND (GJAHR >= '2023' AND BUKRS = 'US01')
Performance Benefits
Table filtering provides significant benefits:
- Reduced data volume: Only relevant records are processed
- Lower costs: Fewer rows counted toward usage billing
- Faster execution: Smaller result sets improve speed
- Network efficiency: Less data transfer between databases
Best Practices
- Start broad, then narrow: Begin with time-based filters like fiscal year
- Test filters: Verify your filter logic returns expected data
- Document filters: Note why specific filters were applied
- Monitor performance: Track validation duration improvements
- Update regularly: Adjust time-based filters as needed (e.g., new fiscal years)
Legacy Compatibility
Existing validation plans continue to work without changes. Table filters are optional and can be added gradually to optimize specific tables as needed.