Skip to content

mohanmuthuraja/prompt_engineering

Repository files navigation

SAP Material Master Data Validation (MARA)

A lightweight Python-based SAP Data Migration validation tool that validates Material Master Basic Data (MARA) before S/4HANA migration. The tool checks common migration issues and generates row-wise validation reports, Good vs Bad record segregation, and Excel summary charts.


📌 Purpose

During SAP ECC → S/4HANA migrations, source data must be validated before loading into migration templates.

This tool helps migration teams to:

  • Validate Material Master Basic Data
  • Identify invalid records
  • Segregate Good and Bad materials
  • Produce migration readiness reports
  • Generate Excel validation reports with charts

📂 Project Structure

sap-material-validation/
│
├── data/
│   └── MARA_export.xlsx
│
├── output/
│   └── MARA_validation_report.xlsx
│
├── validator.py
│
└── README.md

⚙️ Validation Rules Implemented

Rule 1 – Deletion Flag Materials

Field: Deletion Flag (LVORM)

Validation Logic:

  • If material is flagged for deletion, mark the record as Invalid

Error Message:

Material flagged for deletion

Rule 2 – Invalid Material Type

Field: Material Type (MTART)

Allowed Values:

ROH
HALB

Validation Logic:

  • Any material type other than ROH or HALB is invalid

Error Message:

Invalid Material Type (only ROH/HALB allowed)

Rule 3 – Empty Material Group

Field: Material Group (MATKL)

Validation Logic:

  • If Material Group is NULL or Blank
  • Mark record as failed

Error Message:

Material group is mandatory

🧠 Validation Process

Step 1 – Input File

Provide the SAP MARA extract.

Example:

MARA_export.xlsx

The dataset may originate from:

  • SAP ECC table MARA
  • SAP Data Services extract
  • SAP Migration Cockpit preparation files

Step 2 – Run Validation Script

Execute the Python validation script.

Example:

python validator.py

Step 3 – Validation Logic Execution

The script performs the following steps:

  1. Load Excel dataset
  2. Identify key columns
  3. Apply validation rules
  4. Capture row-wise errors
  5. Assign validation status

Each record is marked as:

GOOD
or
BAD

📊 Output Report

The tool generates an Excel report:

MARA_validation_report.xlsx

Sheet 1 – Row Validation Report

Contains:

Material Material Type Material Group Validation Status Error Message

Example:

MATNR MTART MATKL Validation_Status Error_Message
100001 ROH 001 GOOD
100002 FERT BAD Invalid Material Type

Sheet 2 – Summary

Contains aggregated results:

Category Count
GOOD 44
BAD 456

Includes a Pie Chart showing:

Good vs Bad Records

This helps migration teams quickly understand data readiness.


📈 Benefits for SAP Data Migration

This validation tool helps:

  • Reduce migration errors
  • Improve data quality
  • Identify cleanup effort
  • Provide migration readiness reports

Useful for:

  • SAP Data Migration Teams
  • SAP Data Governance Teams
  • SAP S/4HANA Conversion Projects

🧩 Future Enhancements

Additional validations can be easily added:

Examples:

Material Number Validation

Material should contain only numeric values

Duplicate Material Check

MATNR duplicates detection

SAP Date Validation

Check fields like:

ERSDA
LAEDA

Decimal Checks

Validate numeric fields for:

Incorrect decimal format

🛠 Technology Used

  • Python
  • Pandas
  • OpenPyXL
  • Excel Charts

🚀 Example Use Case

SAP Migration Team extracts MARA table from ECC

Run validation tool

Tool generates Validation Report

Clean bad records

Proceed with S/4HANA Migration Cockpit


📄 License

MIT License


👨‍💻 Author

SAP Data Migration Specialist Focus Areas:

  • SAP Data Migration
  • Data Validation
  • SAP ECC → S/4HANA Conversion
  • Migration Data Quality

About

Folder has RTCFR prompt files

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors