Indu Learning Platform
Course/Unit 6 · AI inside MDG
Lesson 6-2

AI for data quality rules

Use MDG's ML rule mining and LLM-drafted rules to find quality rules faster, then let stewards approve them into BRFplus.

Watch firstHow ML helps to identify data quality rules with SAP MDG in SAP S/4HANA (SAP Community Call) · SAP CommunityOpen on YouTube ↗

Two kinds of AI help

Workshops find obvious rules (domestic suppliers need a tax number) and miss implicit ones (in plant 1000, FERT always has MRP type PD). ML rule mining finds IF-THEN patterns in existing records. LLM rule drafting reads a data profile plus policy text. One is grounded but blind to intent; the other understands intent but can hallucinate. With stewards approving, they cover each other.

ML rule mining (in MDG)Finds IF-THEN patterns in existing dataEvery rule comes with a data fit scoreCannot read policies or know intentMay learn bad habits from dirty dataLLM rule drafting (side-by-side)Reads profiles plus policy documentsWrites rules in business languageCan propose rules the data violates todayMust be checked against real datavs
Mining says what the data does; the LLM helps say what it should do.

Rule mining in MDG

Rule mining in MDG data quality management supports Product, Business Partner and custom objects. You pick a focus area and the IF and THEN fields; a background job proposes rules (default cap 100). Setup needs Fiori apps such as Manage Rule Mining, their OData services and authorizations, so involve Basis and security early.

Step through · 1 of 7
Define mining runfocus area, IF/THEN fieldsBackground jobML runs asyncReview proposalsdata evaluationAccept or rejectLink to DQ rulenew, enhance, mergeGenerate BRFplusadd usageApprove and enable
Pick a focused data set, for example suppliers of one company code, and say which fields are conditions and which are checked.
The whole loop stays inside MDG: proposal, decision, enforcement.

An LLM rule-drafting pipeline

Principle: send the model a profile, not the data. A profile (fill rate, distinct count, top patterns per field) plus a few masked samples is usually enough. Your own script then runs each proposal against the full data and computes the real pass rate. Translate proposals into a reviewed rule library; never eval() model-written code.

Profile datafill rates, patternsMask samplesLLM drafts rulesJSONCompute real passratefull data, in-houseSteward reviewBuild in MDGDQ rule / BRFplus
Your script, not the model, decides the pass rate.
Prompt
You help a master data team design data quality rules for SAP MDG
(Business Partner, supplier role).
Inputs: FIELD PROFILE (JSON), POLICY EXTRACT, FIVE MASKED SAMPLE RECORDS.

Propose up to 10 rules. For each return:
- id, rule_text (one business sentence), fields_involved
- condition (IF) and check (THEN), precise and testable
- source: "profile", "policy" or "both"
- expected_pass_rate (0-1), estimated from the profile
- implementation_hint: "BRFplus decision table", "BRFplus formula" or "needs ABAP"
- risk: which legitimate records this rule could block

Use only fields in the profile. Do not invent field names.
Return valid JSON only: {"rules": [...]}

The expected pass rate and 'risk' field catch over-strict rules early.

Try it: complete the principles

Try it · Fill the blanks

Fill the blanks in the team's rule-drafting guideline.

We send the model a  and five masked samples. The real pass rate is computed by . Model proposals are mapped to a  before they run. Every new rule goes live as a  first.

What steward review looks like

Watch the gap between expected and actual pass rate: a big gap means the model misread the profile or there is a hidden segment.

AI-proposed ruleExpectedActualSteward decisionDE supplier needs VAT number97%96.4%Accept as errorBank country = address country90%71.2%Reject (intl. banks)Email has valid domain99%98.8%Accept as warningPayment terms in allowed list95%93.0%Refine: per company codeName has no legal-form typos85%88.1%Accept, cleanse first
'Bank country' would have blocked about 29% of valid suppliers. The computed rate caught it.

Try it: the 18% rule

Try it · What would you do?

An AI-proposed rule 'supplier region must be filled' would fail 18% of suppliers the business says are valid. The project lead wants it live as an error next week. What do you do?

Where the rule is enforced

Three places: DQ evaluation measures the existing stock, mass processing fixes violations as governed CRs, and CR validation blocks new bad data. Order matters: evaluate, remediate, then warn, then error. Otherwise a new rule blocks every change to old, uncleaned records.

Week 0Rule approvedWeek 1DQ evaluation on stockWeeks 2-4Mass remediationWeek 5CR check as warningWeek 7Promote to error
Same order for hand-written and AI-proposed rules.

Measuring value

Track acceptance rate (below about a third, stewards stop reading), false-block rate (valid records failed, seen through overrides) and time to rule. Break acceptance down by category to see where workshops are still needed.

Format (patterns, lengths)78%Completeness (mandatory)71%Value lists55%Cross-field consistency38%Policy-only (no data signal)24%
Illustrative acceptance by category. Measure your own.

Try it: the rule-discovery loop

Try it · Put in order

Put the end-to-end loop for an AI-proposed rule in order.

  1. 1Profile the data and mask samples
  2. 2Compute the real pass rate in-house
  3. 3AI proposes candidate rules
  4. 4Enforce at CR time as a warning, then as an error
  5. 5Steward accepts or rejects
  6. 6Run a DQ evaluation on existing stock
  7. 7Remediate violations through mass processing

Remember

  • ML rule mining finds patterns in data inside MDG; LLM drafting adds policy and business language. Use both, with stewards deciding.
  • Send the model a profile and masked samples, and compute the real pass rate yourself before review.
  • Evaluate, remediate, warn, then enforce; measure acceptance and false-block rates.

Check yourself

What does each MDG rule mining proposal include to help the reviewer?
Why send a data profile instead of the full supplier table to the LLM?
Which number best tells you whether stewards find the AI proposals useful?