Detecting Anomalies and Transaction Fraud with AI on ERP Data
In this article
- An anomaly is not the same as fraud
- Anomalies that are realistic to detect in ERP data
- Start with rules, not a model
- When statistical and machine-learning models help
- The data you need and how to prepare it
- Designing the review workflow
- Controlling false alarms
- Ethics, privacy, and fairness
- Prevention is cheaper than detection
- Implementation steps
- Honest measures of success
- Closing
Fraud in companies is rarely dramatic. More often it looks like an invoice paid twice, a supplier whose address matches an employee's, purchases split to slip under an approval limit, or small repeated stock adjustments made late at night. Each incident is small, but added up over a year the value can be significant. Transaction data in the ERP keeps a trace of all of it; the problem is that nobody has time to read thousands of lines every day. This is where automated rules and AI models can help, by filtering out unusual transactions for a human to review. This article covers which anomalies are realistic to detect, when simple rules are enough, when statistical or machine-learning models help, how to design a review workflow, and an honest view of what a model can prove.

An anomaly is not the same as fraud
The first thing to understand: a model detects the unusual, not the wrong. A transaction can be unusual for legitimate reasons, such as a large purchase ahead of peak season, mass returns caused by a supplier error, or a stock adjustment after a physical count. Conversely, carefully executed fraud can look perfectly normal.
So the system's output should be called a signal or flag for review, not an accusation. The reviewer investigates the context, and disciplinary or legal decisions are never made on a model score alone.
Anomalies that are realistic to detect in ERP data
Purchasing and accounts payable
- Duplicate invoices: the same or similar invoice number, amount, and supplier, including variations in how the number is written.
- Duplicate payments for the same invoice.
- Split transactions: several purchases from the same supplier just under the approval limit within a short window.
- A new supplier that immediately receives a large payment, or a supplier whose bank account, address, or phone matches an employee or another supplier.
- A change of supplier bank details followed by an immediate payment.
- Purchase prices far above history or other quotes.
- Invoices approved by the person who also created the supplier or PO.
Disciplined three-way matching already catches many of these; see accounts payable automation and three-way matching.
Sales, cashiers, and receivables
- Disproportionate discounts, voids, or returns at a particular cashier or salesperson.
- Large credit notes without supporting documents.
- Sales to customers over their credit limit through repeated exceptions.
- Transactions outside working hours or from unusual devices.
The cashier context is covered in more detail in preventing cashier fraud.
Inventory and warehouse
- Repeated negative stock adjustments at the same location or item.
- Stock count differences that always run in one direction.
- Stock movements with no source document.
- High-value items that often suffer unexplained shrinkage.
Finance and journals
- Manual journals with round amounts or amounts just under the approval threshold.
- Period-end journals reversed at the start of the next period.
- Entries by users who rarely post journals.
- Use of accounts unusual for that user or department.
Petty cash and operating advances are also frequent weak points; see petty cash and operating advances with ERP.
Start with rules, not a model
Many companies jump straight to imagining advanced AI, yet most of the early value comes from simple explicit rules. Rules are easy to explain, easy to test, and need no training data.
Examples of useful rules:
- Flag invoices with the same combination of supplier, number, and amount.
- Flag more than three purchases from one supplier within seven days, each at 95 to 100 percent of the approval limit.
- Flag suppliers whose bank account matches an employee's account.
- Flag manual journals on holidays or above a set amount with no attachment.
- Flag stock adjustments above a certain percentage of the balance.
Build 10 to 20 rules like these first, run them regularly, and watch the results for a few months. The review outcomes also become valuable data for the next stage.
When statistical and machine-learning models help
Rules only catch patterns you have already imagined. Models help find deviations nobody thought of, or ones too complex to write as rules.
Unsupervised approaches
If you have no confirmed fraud examples yet, a model can learn the normal pattern and flag what deviates. Common techniques include statistical scores (such as z-scores or distance from the median), isolation forest, and clustering. An example use: detecting payments whose amount, timing, and supplier rarely occur compared with that supplier's own history.
Supervised approaches
If there is a history of confirmed cases, a classification model can learn their features. But confirmed cases are usually very few compared with normal transactions, so the data is imbalanced and the model easily produces many false alarms. With only a handful of cases, this approach is often not viable.
Relationship and network analysis
Some patterns only appear when relationships between transactions are mapped: suppliers sharing an address, account, or owner with an employee; groups of users who approve each other. Graph analysis can help, though careful master data matching is often enough.
The role of large language models
A language model can help summarise why something was flagged, read supporting documents, or draft review notes. But it is poorly suited as the primary detector because its output is not deterministic and can be confidently wrong. Use it as a reviewer's assistant, not a judge, and evaluate its output; the approach is covered in evaluating AI and LLM output quality.
The data you need and how to prepare it
Detection quality is bounded by data quality. Before building anything:
- Make sure supplier, customer, and employee master data is clean and free of duplicates; see [data quality and data governance](/blog/kualitas-data-dan-tata-kelola-data-untuk-bisnis-menengah).
- Make sure logs record who changed what and when, including master data changes. The principle is in [audit trails and internal controls](/blog/jejak-audit-dan-pengendalian-internal-di-sistem-erp).
- Gather 12 to 24 months of transaction data if available.
- Decide who owns each flag: internal audit, finance, or the warehouse head.
- Broader preparation is covered in [company data readiness before an AI project](/blog/kesiapan-data-perusahaan-sebelum-memulai-proyek-ai).
Designing the review workflow
Detection without follow-up only adds burden. Design the flow from the start:
1. Flags enter a review queue with a priority score and a readable reason, such as "invoice similar to invoice number X from the same supplier".
2. The reviewer checks context: supporting documents, history, and, where needed, asks the transaction owner.
3. The reviewer records an outcome: legitimate, process fix needed, needs investigation, or indicates a violation.
4. For serious cases, escalation follows policy: management, compliance, and legal help where necessary. Employee reporting channels are covered in whistleblowing systems and internal reporting channels.
5. Review outcomes return to the system as feedback: legitimate flags are deprioritised, new patterns become rules.
The human-in-the-loop principle matters here; the framework is similar to human-in-the-loop for AI agents in business processes.
Controlling false alarms
A system that generates 500 flags a day will be ignored within a week. Some ways to keep quality up:
- Start with conservative thresholds so flag volume matches reviewer capacity.
- Group similar flags into one case.
- Score priority by monetary value and degree of deviation.
- Record the closing reason for each flag to retune rules.
- Exclude known legitimate patterns, such as seasonal purchases, with an audited allow-list.
- Measure the percentage of flags that lead to real findings; if it is very low, revisit the rules.
Ethics, privacy, and fairness
Anomaly detection touches personal data about employees and customers. Some guidelines:
- Collect and analyse only relevant data, and restrict access to the results.
- Tell employees that transactions are monitored through a clear policy; see [protecting employee personal data](/blog/menjaga-keamanan-data-pribadi-karyawan) and [personal data protection for websites and apps](/blog/pelindungan-data-pribadi-untuk-website-dan-aplikasi).
- Check for bias: does the model flag certain groups or branches more often simply because their working patterns differ?
- Never make a model score the sole basis for action against a person.
- Document the logic and reason behind each flag so it can be explained if challenged.
Broader operational AI risks are covered in AI risks in operations.
Prevention is cheaper than detection
Detection is the second layer. The first layer is controls that make fraud hard to commit:
- Segregation of duties between whoever creates suppliers, orders, receives, and pays.
- Tiered approval by value.
- Independent verification when a supplier's bank details change, for example confirmation through a phone number already on file.
- Job rotation and mandatory leave for sensitive positions.
- Role-based access; see [designing user access rights](/blog/merancang-hak-akses-pengguna).
Implementation steps
1. Map the main risks: which cycle is most exposed in your business.
2. Clean the master data and make sure change logs are available.
3. Build 10 to 20 explicit rules and run them daily or weekly.
4. Set up a review queue with owners, deadlines, and an outcome format.
5. After three to six months, evaluate and consider statistical models for areas rules cannot reach.
6. Test the model separately on historical data and compare with the rules.
7. Review policy and employee training periodically.
Honest measures of success
- Number of flags, percentage that lead to findings, and average review time.
- Value of losses prevented or recovered, calculated conservatively and only what is documented.
- Process control changes that resulted from findings.
- Reviewers' trust in the system; if they ignore it, something needs fixing.
Do not promise that the system will catch all fraud. Someone who understands the system can evade it, which is why preventive controls remain the priority.
Closing
Anomaly detection with rules and AI is a useful aid for reviewers, not a replacement for internal controls or human judgement. Start with simple rules on the riskiest cycle, clean the data, design the follow-up flow, and add models only when rules are no longer enough. If you want to prepare ERP data and review flows for realistic, defensible anomaly detection, the Agsora team can help map risks and design a staged rollout.
Design realistic anomaly detection for your business
Talk through your transaction risks and ERP data readiness with the Agsora team to plan a staged, defensible rollout.
Free consultationRecommended for you
Reading related to this topic
AI Agent Identity and Access Control in Business Applications
Give AI agents their own identity and least privilege: action matrix, API enforcement, short-lived credentials, human approval, logs, stop switch, and a 30-day plan.
From Vibe-Coded Prototype to Production App: A Practical Checklist
How to make an AI-built app dependable: code ownership, secrets, authorisation, data and backups, dependencies, tests, payments, monitoring, cost limits, and when to rewrite.
Intelligent Document Processing (IDP): OCR and AI for Invoices, POs, and Delivery Notes
A guide to using OCR and AI to read invoices, POs, and delivery notes: classification, field extraction, business-rule validation, master data matching, human review, honest automation thresholds, and security and forged-document risks.
Free checklist: choosing a software house
24 points to evaluate a vendor before you sign. Can be saved as a PDF.
Ready to build a system that grows with your business?
Discuss your needs with the AG·SORA team, no cost, no commitment.