🔍 What is an Audit Trail in SAP?
Audit trail in SAP ECC and S4/HANA is the complete, safe record of every change made to any bit of data in the SAP system - who changed it, when they changed it, what the old value was, and what the new value is. SAP builds audit trail capability into every module automatically. When a vendors bank account is changed, when a purchase order price is modified after approval, when an employee salary is updated, when a production order quantity is revised - SAP records every one of these changes permanently using its Change Document framework (CDHDR + CDPOS), FI document history, HR infotype change logs, and module-specific audit tables. This is not optional - it is the foundation of financial compliance, regulatory audit readiness (SOX, GDPR, GMP, IS0 9001), and internal controls in every SAP implementation world-wide.This tutorial or document breaks down the process step by step, using simple language and real-world examples to help you master the skill.
Change Documents
CDHDR + CDPOS track every field-level change to master data and transactional documents across MM, SD, FI, and HR.
Immutable FI Documents
FI accounting documents can never be changed - only reversed. Every posting in BKPF/BSEG is permanent with full timestamp and user ID.
Regulatory Compliance
SAP audit trails meet SOX Section 404, FDA 21 CFR Part 11, GMP Annex 11, GDPR, and ISO 9001 audit requirements out of the box.
📋 The CDHDR / CDPOS Framework - SAP's Universal Audit Engine
The Change Document framework is SAP's universal audit trail engine. It applies to virtually every master data object and many transactional documents across all modules. Think of it as SAP's internal black box recorder - whenever a user saves a change to a vendor master, a purchase order, a material master, a customer record, or a sales order, SAP writes a header record to CDHDR and one detail record per changed field to CDPOS. Auditors can then reconstruct the exact history of any data record - field by field, date by date, user by user - going back years.
Imagine the internal audit team at Precision Components Pvt Ltd, a tier-2 automotive supplier in Pune, has been asked by their external auditors to prove that no purchase order was modified after it was approved and converted to a legal obligation. The audit manager needs to provide a complete field-level change history for every PO raised in FY2025. Here is exactly how this is done in SAP using the Change Document framework:
Atul Precision Components - PO Post-Approval Change Audit
On 03-Apr-2025, buyer Pramod Behera creates PO 4500012347 for 200 units of Alloy Steel Rods (Part ASTR-220) from vendor Pooja Metals Ltd at ₹1,800/unit = ₹3,60,000 total. PO is approved by the plant manager. PO header data is saved in EKKO (EBELN = 4500012347) and item data in EKPO. The original approved price ₹1,800 is now legally committed.
T-Code: ME21N · Tables: EKKO (header) · EKPO (item) · CDHDR/CDPOS (change record)On 18-Apr-2025, senior buyer Sujata Sharma opens the PO in ME22N and changes the unit price from ₹1,800 to ₹2,050 citing "market rate revision." This single change immediately creates two records in SAP: a header in CDHDR (change document header: document number, object class EKKO, date 18-Apr-2025, time 14:32:11, user ANITA.SHARMA) and a detail in CDPOS (field NETPR, old value 1800.00, new value 2050.00, table EKPO, PO number 4500012347). The system records this permanently - it cannot be deleted.
T-Code: ME22N · Tables: CDHDR (header) · CDPOS (field-level old/new values)The audit manager pulls the change document report. In SE16N on table CDHDR: filter OBJECTCLAS = 'EINKBELEG' (purchasing document), UDATE between 01-Apr-2025 and 31-Mar-2026. Result: 47 change records found across all POs. Join CDHDR to CDPOS on CHANGENR to see exactly which field was changed on each PO. Alternatively, display PO 4500012347 in ME23N and click the "Changes" button (Environment → Document Changes) to see the complete field-level history in a formatted view.
T-Code: ME23N → Environment → Document Changes · SE16N on CDHDR + CDPOSFor a bulk extraction of all PO price changes in FY2025, the ABAP team runs a query joining CDHDR (filter: OBJECTCLAS = 'EINKBELEG', FNAME = 'NETPR') with CDPOS. The query returns: PO number, line item, change date, changing user, old price, new price, and delta amount. 47 PO price changes identified. Of these, 12 were changed without a fresh approval workflow - flagged as a control deficiency in the audit report. Root cause: approval workflow was not configured to re-trigger on price changes.
T-Code: SQVI (Quick Viewer) · SE16N · Custom ABAP report on CDHDR + CDPOSBased on the audit finding, the SAP BASIS / workflow team configures the approval workflow (transaction SWI2_ADM1) to re-trigger the approval chain whenever the NETPR (net price) field in EKPO increases by more than 5% after initial approval. Change is transported to production. Going forward, any price change exceeding the threshold requires fresh manager approval before the PO can be saved - and the CDHDR/CDPOS trail will show both the change attempt and the approval response, giving auditors complete end-to-end visibility.
T-Code: SWI2_ADM1 (Workflow) · SWDD (Workflow Builder) · Transport via SE10| Table | Field | Description | Example Value |
|---|---|---|---|
| CDHDR | CHANGENR | Change document number (primary key) | 0000000187634 |
| CDHDR | OBJECTCLAS | Object class - identifies which SAP object was changed | EINKBELEG (PO) · KRED (Vendor) · DEBITOR (Customer) |
| CDHDR | OBJECTID | Object key - the document or master record number | 4500012347 (PO number) |
| CDHDR | UDATE / UTIME | Date and time of change | 18.04.2025 / 14:32:11 |
| CDHDR | USERNAME | User ID who made the change | ANITA.SHARMA |
| CDPOS | CHANGENR | Links to CDHDR on this key | 0000000187634 |
| CDPOS | TABNAME | Table where the field was changed | EKPO |
| CDPOS | FNAME | Field name that was changed | NETPR |
| CDPOS | VALUE_OLD | Value before the change | 1800.00 |
| CDPOS | VALUE_NEW | Value after the change | 2050.00 |
Key CDHDR Tip: Different SAP objects use different OBJECTCLAS values in CDHDR. The most important ones to know: EINKBELEG = Purchasing document (PO/PR), KRED = Vendor master, DEBITOR = Customer master, MATERIAL = Material master, AUFK = Order (production/internal), PROJ = Project definition. Always filter CDHDR by OBJECTCLAS first - this instantly narrows your audit query from millions of rows to just the relevant object type.
💰 FI Document Audit Trail - Every Rupee Permanently Recorded
In SAP Financial Accounting, the audit trail philosophy is fundamentally different from the Change Document approach. FI accounting documents are immutable - they can never be changed, only reversed. When a journal entry is posted in FB01, an invoice in MIRO, or a payment in F110 - that accounting document is locked permanently in tables BKPF and BSEG with the user ID, timestamp, and exact financial amounts. Any error correction must be done by posting a reversal document - which itself creates a new permanent record. This gives auditors a complete, unbreakable chain of every financial event in the company.
Imagine the CFO of Pramod Textile Mills Ltd has received an urgent query from SEBI regarding some suspicious inter-company transfers posted in the FI ledger during October 2024. The company's internal auditor must reconstruct the complete audit trail - who posted the entries, when, through which transaction, and what approval existed - within 48 hours of the query.
Luxi Textile Mills Ltd - SEBI Query on Suspicious FI Postings
The auditor opens FBL3N for G/L account 198000 (Inter-Company Transfers) for company code NTM1, period October 2024. The report reads BSIS (open items) and BSAS (cleared items) joined to BKPF on BUKRS + BELNR + GJAHR. Results show 14 postings totalling ₹4.2 crore. Key BKPF fields: BLART (document type), USNAM (posting user), CPUDT (entry date), CPUTM (entry time), TCODE (transaction code used). Three entries show document type AB (accounting document) posted at 11:45 PM by user SYSADMIN - immediately suspicious.
T-Code: FBL3N (Line Items) · FB03 (Display FI Document) · Tables: BKPF + BSEG + BSISThe auditor double-clicks on suspicious document 1900000445 in FBL3N to open it in FB03. Every field in BKPF is visible: document date 31-Oct-2024, posting date 31-Oct-2024, entry time 23:47:32, user SYSADMIN, reference text "Month-end provision", transaction code FB01. The line items in BSEG show: ₹1.8 crore debit to account 198000 (Inter-Company), ₹1.8 crore credit to account 400000 (Sales Revenue). Crediting sales revenue via a late-night manual journal entry is a major red flag. The document is permanently visible - it cannot be hidden or deleted.
T-Code: FB03 (Display Document) · Tables: BKPF (header) · BSEG (line items)A properly controlled FI document should first be parked (saved incompletely for approval) before being posted. The auditor checks whether document 1900000445 was ever parked and approved. Table VBKPF stores parked document headers. Result: no parked document exists with matching reference - meaning this ₹1.8 crore journal entry was posted directly using FB01 without any parking or dual approval workflow. This is a second control failure that supports the SEBI query findings.
T-Code: FBV3 (Display Parked Document) · Tables: VBKPF (parked header) · VBSEG (parked items)The security team runs the SM20 security audit log to check all activities performed by user SYSADMIN on 31-Oct-2024. SM20 shows every transaction executed, every authorisation check, and every logon/logoff event. Result: SYSADMIN logged in at 23:41, executed FB01 three times (posting ₹1.8Cr, ₹0.9Cr, ₹1.5Cr to account 198000), and logged off at 23:58. Total suspicious posting in 17 minutes: ₹4.2 crore. The SM20 log proves the exact sequence of events and is admissible as digital evidence.
T-Code: SM20 (Security Audit Log) · SM21 (System Log) · SU53 (Auth Check)The CFO decides the three documents must be reversed after SEBI review. The auditor uses FB08 to reverse each document with reversal reason 01 (Reversal in current period). SAP creates three new mirror-image documents - same amounts, opposite signs - permanently clearing the incorrect entries. Both the original document and its reversal remain in BKPF/BSEG forever with clear cross-references. The FI audit trail now shows: original posting by SYSADMIN at 23:47 + reversal authorised by CFO at 09:15 on 05-Nov-2024. The complete story is permanently on record.
T-Code: FB08 (Reverse Document) · Tables: BKPF.STBLG (reversal document) · BKPF.STJAH (reversal year)| BKPF Field | Description | Audit Relevance | Example |
|---|---|---|---|
| USNAM | User who posted the document | Identifies the individual responsible - non-repudiation | SYSADMIN / RAMESK |
| CPUDT | Entry date (date document was created in system) | Detects backdating - compare CPUDT vs BUDAT | 31.10.2024 |
| CPUTM | Entry time (time of system posting) | Late-night postings flag suspicious activity | 23:47:32 |
| TCODE | Transaction code used to post the document | Shows HOW the document was created (FB01, MIGO, VF01) | FB01 |
| BLART | Document type (SA=GL, KR=Vendor inv, DR=Customer inv) | Unexpected document types on accounts reveal anomalies | AB (Accounting doc) |
| STBLG | Reversal document number | Links original document to its reversal - complete audit chain | 1900000448 |
| BKTXT | Document header text | Vague texts like "adjustment" need investigation | Month-end provision |
| WAERS | Currency | Foreign currency documents require FX rate validation | INR / USD |
Key FI Audit Principle: In SAP FI, document date (BLDAT), posting date (BUDAT), and entry date (CPUDT) are three different fields. A suspicious pattern is when CPUDT (when it was physically entered) is significantly later than BUDAT (the accounting period). For example: BUDAT = 31-Mar (quarter-end) but CPUDT = 15-Apr - the entry was backdated to the previous quarter. SAP records CPUDT automatically from the system clock - it cannot be manipulated by end users. This makes it the most reliable audit field in the entire FI module.
📦 MM Audit Trail - Tracking Every Material Movement And Master Change
In SAP MM, the audit trail operates on two levels. The first is goods movement history - every goods receipt, goods issue, transfer, and adjustment creates a permanent material document in MKPF/MSEG that can never be modified. The second is master data change history - every change to a vendor master, material master, or purchasing info record is recorded in CDHDR/CDPOS. Together these two layers give supply chain auditors complete visibility into what stock moved, when, and how master data supporting that movement was configured.
Picture the quality and compliance team at Pramod Pharmaceuticals Ltd in Hyderabad. A batch of raw material API-PARA-500 (Paracetamol API) has been recalled by their vendor after a contamination issue was discovered. The compliance team must trace every kilogram of that batch - where it was received, what happened to it in stock, which production batches used it, and whether any finished goods containing it were already dispatched to customers. This is a regulatory batch traceability audit - and SAP provides the complete answer.
Pramod Pharmaceuticals Ltd - Contaminated Batch Regulatory Traceability Audit
The compliance manager opens MB56 (Batch Where-Used List) and enters batch number B-API-2025-0301 for material API-PARA-500. MB56 reads MSEG filtered by MSEG.CHARG = 'B-API-2025-0301' and traces every goods movement involving this batch. Result: 2 GRs found - 15-Mar-2025 (500 kg received against PO 4500009876, movement 101) and 22-Mar-2025 (200 kg received against PO 4500009901, movement 101). Total received: 700 kg of potentially contaminated API. Both material documents permanently recorded in MKPF (header) and MSEG (items).
T-Code: MB56 (Batch Where-Used) · MB51 (Material Doc List) · Tables: MSEG (filter: CHARG)The compliance team checks whether QM inspected this batch on arrival. QA32 shows inspection lot 1000045 was created on 15-Mar-2025 for batch B-API-2025-0301 (origin 01 - incoming inspection). Usage Decision = ACCEPTED on 17-Mar-2025 by user QA.SURESH. The acceptance allowed the batch into unrestricted stock. Table QALS (inspection lot header: MATNR, CHARG, PRUEFDAT) and QAVE (test results: all parameters passed). The QM audit trail is complete - showing who released the batch and based on what test values.
T-Code: QA32 (Inspection Lot) · Tables: QALS (lot header) · QAVE (results) · QASR (summary)MB56 continues tracing: batch B-API-2025-0301 was issued to production orders PO-800345 (18-Mar, 300 kg, mvt 261), PO-800367 (24-Mar, 250 kg, mvt 261), and PO-800389 (28-Mar, 100 kg, mvt 261). Total issued to production: 650 kg. Each GI created a material document in MSEG (BWART = 261). The 50 kg remaining in stock is identified via MMBE (still shows 50 kg in quality batch B-API-2025-0301 in storage location QC-HOLD). The three production orders produced finished good batches FG-20250320, FG-20250326, and FG-20250402 - all must be quarantined.
T-Code: MB56 · COOIS (Prod Order Info) · MMBE (Stock) · Tables: MSEG · AFKO · MKPFMB56 extended to finished goods: batch FG-20250320 - 10,000 tablets despatched to hospital customer HOSP-Chennai-07 via delivery 80001234 on 25-Mar-2025. Batch FG-20250326 - 8,000 tablets in warehouse (not yet despatched, can be recalled immediately). Batch FG-20250402 - 12,000 tablets despatched to HOSP-Bengaluru-03 on 05-Apr-2025. Sales delivery documents in LIKP/LIPS with confirmed GI in MKPF/MSEG. Two hospitals must be notified for product recall. The complete forward trace from raw material GR to customer delivery is done in under 30 minutes using SAP audit trail.
T-Code: MB56 (forward trace) · VL03N (Delivery) · Tables: LIKP · LIPS · MSEG · CHVW (batch ledger)The compliance manager blocks the remaining 50 kg of batch B-API-2025-0301 using MIGO (movement type 344 - transfer to blocked stock). FG-20250326 (8,000 tablets in warehouse) is blocked using a Quality notification (QM02) setting batch status = BLOCKED in the batch master (table MCH1: ZUSTD = blocked). A formal Q2 vendor complaint notification (QM01) is raised against the API supplier with the recall details, test evidence, and corrective action request. All actions permanently recorded in SAP - complete regulatory dossier ready for FDA/CDSCO inspection within 4 hours of the recall trigger.
T-Code: MIGO (344) · QM01 (Notification) · Tables: MSEG · MCH1 · QMEL · QMMAKey MM Audit Principle: In SAP MM, the material document (MKPF/MSEG) is the permanent, immutable record of every physical stock movement. It can never be changed or deleted - only reversed with a counter-movement. Table CHVW (Batch Where-Used List) is the master batch traceability table - it links batches across the entire supply chain from GR to customer delivery. For pharmaceutical, food, and chemical companies, the ability to complete a forward and backward batch trace in under 1 hour is a core GMP compliance requirement - and SAP provides this capability out of the box.
👥 HR Infotype Audit Trail - Every Salary Change Tracked
SAP HR has one of the most comprehensive audit trail frameworks in the entire SAP system. Every change to every infotype - salary, personal data, bank account, leave entitlement, organisation assignment - is tracked using the infotype's built-in validity period mechanism (BEGDA/ENDDA) combined with change documents in CDHDR/CDPOS. When a salary is changed, SAP does not overwrite the old record. It creates a brand new PA0008 row for the new salary and sets the ENDDA of the old row to the day before the change - preserving the complete salary history forever.
Consider the payroll audit scenario at Pramod Infrastructure Projects Ltd in Bengaluru. The company's HR compliance officer has received a whistleblower complaint alleging that a payroll administrator made unauthorised salary increases for three employees linked to a supervisor during the last financial year. The HR Director must investigate and provide a complete, irrefutable audit trail of all salary changes in FY2025 and who authorised them - within 24 hours for a board meeting.
Pramod Infrastructure Projects Ltd - Whistleblower Salary Change Investigation
The HR compliance officer opens PA20 (Display HR Master Data) for the three employees flagged by the whistleblower - personnel numbers E-10234, E-10289, E-10312. For Infotype 0008 (Basic Pay), all historical records are displayed - SAP shows every single salary change since the employee's hire date, with BEGDA (effective date), ENDDA (end date), BSGRD (pay grade), LGART (wage type), and BETRG (amount). Employee E-10234 shows three salary changes in FY2025 - unusual. Standard practice is one annual revision in April. The two additional changes (July and November) are immediately suspicious.
T-Code: PA20 (Display IT) · PA03 (Display Change Documents) · Tables: PA0008 (all records for PERNR)PA03 (Display Change Documents for an Employee) shows the complete audit log for a specific personnel number. For PERNR E-10234, Infotype 0008: Change 1 (01-Apr-2025, ₹45,000→₹52,000, user HR.RAMAIAH - legitimate annual increase, approved in PA40 action). Change 2 (15-Jul-2025, ₹52,000→₹63,000, user HR.NAGESWARA - no corresponding PA40 action found, no manager approval workflow triggered). Change 3 (01-Nov-2025, ₹63,000→₹71,000, user HR.NAGESWARA - same user, no approval). CDHDR for OBJECTCLAS = 'PERSDATA', OBJECTID = 'E-10234' confirms same user, same 11:30 PM time pattern for both changes.
T-Code: PA03 (Employee Change Doc) · SE16N on CDHDR (OBJECTCLAS = 'PERSDATA')To confirm the salary increases were actually paid (not just data-entered but not processed), the compliance officer checks payroll results for periods July–November 2025 using PC_PAYRESULT. Payroll cluster table PCL2 shows wage type M010 (basic pay) with the increased amounts in the July and November payroll runs for E-10234. The unauthorised salary increases of ₹11,000 and ₹8,000 per month were processed and paid - actual financial loss to the company from mid-July to December = ₹19,000 × 5.5 months = ₹1,04,500. This amount is now a quantified audit finding for the board report.
T-Code: PC_PAYRESULT (Payroll Results) · Tables: PCL2 (cluster - not SE16N queryable directly)The security team runs SUIM (User Information System) to check whether HR.NAGESWARA's authorisation profile allowed changes to Infotype 0008 without workflow approval. Result: the user had authorisation object P_ORGINCON with access to Infotype 0008 for all personnel areas - a segregation of duties failure. The user should only have READ access to salary infotypes, not WRITE access without approval workflow. SU53 confirms the exact authorisation objects used during the salary change postings. SAP security remediation: remove P_ORGINCON write access from all payroll data entry users and mandate workflow approval for IT 0008 changes.
T-Code: SU53 (Auth Check Display) · SUIM (User Info System) · AUTH object: P_ORGINCONKey HR Audit Principle: In SAP HR, the authorisation object P_ORGINCON (HR: Master Data - Organisational Key) controls who can read or write salary data (Infotype 0008). The most important internal control in HR is Segregation of Duties - the person who ENTERS a salary change must be different from the person who APPROVES it. In practice, use a Structural Authorisation Profile (table T77PR) to restrict HR users so they can only maintain data for employees in their own organisational area - never for employees outside their scope or above their own pay grade.
🏦 Vendor Bank Account Change Audit - The One Fraud Risk in SAP
One of the highest-risk audit scenarios in any SAP system is an unauthorised change to a vendor's bank account number. This is a classic payment fraud vector - a fraudster with access to the vendor master (transaction FK02) changes the bank account number of a genuine vendor to a fraudulent account. The next APP (F110) payment run then sends money to the fraudster's account instead of the real vendor. SAP records every such change in CDHDR/CDPOS, and many companies add a Dual Control configuration that requires a second person to confirm any bank account change before it becomes active. This scenario shows how to detect, investigate, and prevent this attack.
This is a real risk pattern at Pramod Ceramics Manufacturing Ltd in Visakhapatnam, which processes over ₹12 crore in vendor payments every month. An internal audit spot-check reveals that vendor V-00456 (Andhra Clay Suppliers) received ₹48 lakh in a payment run on 07-Jun-2025 - but the actual vendor is calling to say they never received it.
Pramod Ceramics Manufacturing Ltd - Vendor Bank Account Fraud Investigation
The auditor opens FK03 (Display Vendor) for vendor V-00456 and navigates to Payment Transactions tab - the current bank account shows account 9876543210 at a private bank. The original account registered during vendor onboarding was 1234567890 at State Bank. Change Document query: SE16N on CDHDR with OBJECTCLAS = 'KRED' (vendor master), OBJECTID = '0000V-00456'. Result: one change record found, date 04-Jun-2025 at 22:15, user AP.TRAINEE01. CDPOS shows field BANKN (bank account number) changed from 1234567890 to 9876543210. A trainee user changed a vendor bank account at 10 PM three days before a ₹48 lakh payment run - clear fraud pattern.
T-Code: FK03 (Display Vendor) · SE16N on CDHDR (OBJECTCLAS='KRED') + CDPOS (FNAME='BANKN')The auditor opens FBL1N for vendor V-00456 and finds payment document 2500008901 dated 07-Jun-2025 for ₹48,02,400. FB03 on this document shows: posted by F110 (automatic payment), bank HDFC, house bank main account, cleared against 4 open invoices. BKPF.USNAM = F110 (system), BKPF.TCODE = F110. The payment run (LAUFD = 07-Jun-2025) details are in table REGUH (payment run header: bank, payment method, amount) and REGUP (payment items: vendor, invoice, clearing document). The bank transfer file was sent to HDFC on 07-Jun - the fraudulent account number was on the NEFT file.
T-Code: FBL1N · FB03 · Tables: BKPF · BSAK · REGUH (run header) · REGUP (run items)SM20 Security Audit Log for user AP.TRAINEE01 on 04-Jun-2025: logged in at 22:08, executed FK02 at 22:14, changed bank account of V-00456 at 22:15, logged off at 22:19. No other activity. The user's access log shows this was their first ever FK02 execution - they had never accessed FK02 before. SUIM shows AP.TRAINEE01 was assigned authorisation profile SAP_ALL (full system access) - a catastrophic access control failure. A trainee with SAP_ALL can change any master data in the entire system without restriction or oversight.
T-Code: SM20 (Security Log) · SUIM (User Auth Report) · Tables: USR02 · AGR_USERS · UST04Post-incident, the SAP security team configures Dual Control for Vendor Master via SPRO → FI → AP → Vendor Accounts → Master Data → Define Sensitive Fields for Dual Control. Field BANKN (bank account) and BANKL (bank key) are added as sensitive fields. Now, when any user changes the bank account of a vendor in FK02, the record is saved in a pending/unconfirmed state - the change does NOT become active until a second authorised user confirms it in FK08 (Confirm Vendor Changes). Table VBKNA stores the pending change. This single configuration change would have prevented the entire fraud.
T-Code: SPRO (Dual Control Config) · FK08 (Confirm Changes) · Tables: VBKNA (pending vendor changes)Key Vendor Fraud Prevention: SAP's Dual Control for Vendor Master (activated via SPRO → FI → AP → Define Sensitive Fields) is the single most important anti-fraud control in any SAP FI implementation. Once activated, any change to a sensitive field (bank account, IBAN, SWIFT code) creates a pending record in VBKNA that must be confirmed by a second user in FK08. A report on pending vendor changes (S_ALR_87012086) should be checked daily by the treasury team. Combined with the CDHDR/CDPOS audit trail, this configuration makes vendor payment fraud detectable and preventable in real time.
🔬 QM Electronic Signature Audit Trail - FDA 21 CFR Part 11
For pharmaceutical, biotechnology, and medical device companies operating under FDA regulations, the quality management audit trail must meet the requirements of 21 CFR Part 11 (Electronic Records and Electronic Signatures). This regulation requires that any action affecting product quality - entering a test result, making a usage decision, approving a batch - must be authenticated with an electronic signature that is attributable, legible, and contemporaneous. SAP QM's Digital Signature framework meets these requirements by requiring users to authenticate (enter their user ID and password) before any QM action is saved, and recording the authentication in a tamper-proof log.
At Pramod Biotech Research Ltd in Hyderabad, an FDA pre-approval inspection is scheduled for their facility. The FDA investigator requests a demonstration that the electronic batch record for Batch QA-INSULIN-2025-0412 complies with 21 CFR Part 11. The QA manager must produce a complete, unbroken audit trail for every quality action taken on this batch - from raw material testing to finished product release.
Pramod Biotech Research Ltd - FDA Pre-Approval Electronic Batch Record Audit
Inspection Lot IL-2025-0401 for API batch B-API-0401 arrives. QA analyst Dr. Priya Nair opens QA32 to record results. For each characteristic (Assay 99.3%, Moisture 0.08%, Heavy Metals ND, Microbial Count within spec), Dr. Priya enters the measured values. On saving the results, SAP displays the Digital Signature dialog: "Please authenticate - User ID: [priya.nair] Password: [****] Reason: [Results entered from laboratory notebook LNB-2025-041 page 34]." The signature is saved in the DRAD (digital signature log) table with timestamp 09:23:14, user priya.nair, transaction QA32, and the reason text. This meets 21 CFR Part 11 Section 11.50 (signature manifestation).
T-Code: QA32 (Results Recording) · Tables: QALS · QAVE · DRAD (digital signature log)After reviewing all results, QA Supervisor Mr. Arjun Mehta makes the Usage Decision in QA11 for IL-2025-0401: UD Code A (Accept). SAP requires a second digital signature here since the Usage Decision is a GMP-critical action configured for dual-role authentication. Signature 1: arjun.mehta enters password + reason "All results within specification, batch released for production." Signature 2: QA Manager dr.sridhar also authenticates: "Reviewed and independently verified - Release approved." Both signatures recorded in DRAD with timestamps. The batch moves to unrestricted stock via movement 321. The UD cannot be changed once signed - only reversed with a new, separately signed UD.
T-Code: QA11 (Usage Decision) · Tables: QALS (UD field QKENNZ) · DRAD (dual sig log)During tablet compression, 16 inspection points are recorded every 30 minutes (weight, hardness, disintegration, friability). Each inspection point save in QA32 requires a digital signature from the production analyst present at the machine. Each of the 16 signatures is logged in DRAD: user ID, exact time, machine ID in reason text, and the measured values in QAVE. The FDA investigator can see that every 30-minute measurement was signed by a physically present analyst - there are no retroactive entries (CPUDT = actual measurement time, not hours later). This demonstrates real-time data integrity under 21 CFR Part 11 Section 11.10(e) (audit trail for GMP records).
T-Code: QA32 (Inspection Points) · Tables: QAVE (results) · DRAD (16 individual signatures)The QA manager generates the complete Electronic Batch Record for Batch QA-INSULIN-2025-0412 using custom batch record report QGA4 (or a smartform built on QALS + QAVE + DRAD + MKPF). The report shows: all incoming material QM results with analyst signatures, all in-process inspection point data with operator signatures, finished product release results with QA manager dual signatures, batch disposition (UD = Accept, released 22-Apr-2025 14:45), and equipment calibration status at time of manufacture. The FDA investigator reviews the 47-page electronic batch record - all entries are time-stamped, user-attributed, and unchangeable. Zero observations on data integrity. Facility approved.
T-Code: QGA4 (Batch Record) · Tables: QALS · QAVE · DRAD · MCH1 · MSEG21 CFR Part 11 SAP Configuration Checklist: (1) Activate Digital Signature in SPRO → QM → Quality Inspection → Digital Signature. (2) Assign signature strategies to QM transactions (QA11, QA32, QF01). (3) Configure dual-role signatures for UD and final release. (4) Activate SM20 Security Audit Log with event classes DL (Dialog Logon) and AU (User Change). (5) Disable back-dating of QM documents. (6) Test the signature log (DRAD) is populated and cannot be deleted via any standard transaction. (7) Document all configurations in the GxP System Validation dossier. These 7 steps make SAP QM compliant with 21 CFR Part 11 and GMP Annex 11.
💻 ABAP Code - Querying the SAP Audit Trail Programmatically
Every SAP consultant and developer should know how to query the CDHDR/CDPOS tables using ABAP to extract audit trail data for any object. The code below shows the standard pattern for pulling all field-level changes to purchase orders in a given period - the exact same logic used in thousands of SAP compliance reports worldwide.
"═══════════════════════════════════════════════════════════ " SAP Audit Trail - Purchase Order Change Document Extractor " Object Class : EINKBELEG (Purchasing Documents) " Tables used : CDHDR (Change Doc Header) + CDPOS (Field Detail) "═══════════════════════════════════════════════════════════ REPORT z_po_audit_trail. "──── Selection screen ──────────────────────────────────── SELECT-OPTIONS: s_date FOR sy-datum DEFAULT sy-datum, s_uname FOR sy-uname, s_ebeln FOR ekpo-ebeln. "──── Data declarations ─────────────────────────────────── TYPES: BEGIN OF ty_result, changenr TYPE cdhdr-changenr, objectid TYPE cdhdr-objectid, udate TYPE cdhdr-udate, utime TYPE cdhdr-utime, username TYPE cdhdr-username, tabname TYPE cdpos-tabname, fname TYPE cdpos-fname, value_old TYPE cdpos-value_old, value_new TYPE cdpos-value_new, END OF ty_result. DATA: lt_result TYPE TABLE OF ty_result. "──── Read change documents (CDHDR → CDPOS join) ────────── SELECT h~changenr h~objectid h~udate h~utime h~username p~tabname p~fname p~value_old p~value_new INTO TABLE @lt_result FROM cdhdr AS h INNER JOIN cdpos AS p ON p~changenr = h~changenr WHERE h~objectclas = 'EINKBELEG' "PO / SA / Contract AND h~udate IN s_date "Date range AND h~username IN s_uname "User filter AND h~objectid IN s_ebeln "PO number filter AND p~chngind = 'U'. "U=Update, I=Insert, D=Delete "──── Sort and output ───────────────────────────────────── SORT lt_result BY objectid udate utime. LOOP AT lt_result INTO DATA(ls). WRITE: / ls-objectid, ls-udate, ls-utime, ls-username, ls-tabname, ls-fname, ls-value_old, '→', ls-value_new. ENDLOOP.
| OBJECTCLAS Value | SAP Object | Module | Common Audit Use |
|---|---|---|---|
| EINKBELEG | Purchasing document (PO, contract, SA) | MM | PO price / quantity changes after approval |
| KRED | Vendor master | MM / FI | Bank account, payment terms, address changes |
| MATERIAL | Material master | MM | Price control, MRP type, valuation class changes |
| DEBITOR | Customer master | SD / FI | Credit limit, payment terms, bank changes |
| AUFK | Production / PM / internal orders | PP / PM / CO | Quantity, dates, cost centre assignment changes |
| PROJ | Project definition | PS | Project dates, responsible person changes |
| PSPHI | WBS elements | PS | WBS budget, responsible, account assignment changes |
| PERSDATA | HR personnel data (infotypes) | HR | Salary, bank account, leave entitlement changes |
| LSMW_OBJECT | Data migration objects | ABAP | Audit mass data loads via LSMW |
| KAUFBELEG | Sales documents (SO, quotation) | SD | Price, quantity, delivery date changes after creation |
ABAP Performance Tip: CDHDR and CDPOS are among the largest tables in any SAP production system - CDHDR can have hundreds of millions of rows in a mature system. Always filter CDHDR first with OBJECTCLAS (indexed field) before joining to CDPOS. Never start a query on CDPOS directly - it has no efficient index on FNAME alone. The correct pattern is: SELECT from CDHDR WHERE OBJECTCLAS = 'xxx' AND UDATE IN range → collect CHANGENR values → SELECT from CDPOS WHERE CHANGENR IN collected list. This reduces runtime from hours to seconds.
📋 SAP Audit Trail - Complete Module Reference
Use this table as your definitive reference for every audit trail mechanism across all SAP modules - which tables to query, which T-codes to use, and what each trail proves to an auditor.
| Module | Audit Trail Type | Key Tables | T-Code to View | What It Proves |
|---|---|---|---|---|
| ALL | Master Data Changes | CDHDR + CDPOS | SE16N / PA03 / ME23N → Changes | Who changed which field, when, from what value to what value |
| FI | FI Document Trail | BKPF + BSEG | FB03 / FBL3N / FBL1N | Immutable record of every financial posting - user, time, T-code |
| FI | Parked Document History | VBKPF + VBSEG | FBV3 / FV60 | What was saved before final posting - approval workflow state |
| FI | Payment Run Audit | REGUH + REGUP | F110 Display / PAYR | Which invoices were selected, which bank account paid, run parameters |
| FI-AA | Asset Change History | ANLA + ANLZ + ANEP | AW01N / S_ALR_87011963 | Asset acquisition, retirement, transfer, depreciation history |
| MM | Goods Movement History | MKPF + MSEG | MB51 / MB56 | Every kg / unit of material moved - mvt type, batch, user, date |
| MM | PO Change History | CDHDR + CDPOS (EINKBELEG) | ME23N → Environment → Changes | Price, quantity, delivery date changes after PO approval |
| MM | Vendor Master Changes | CDHDR + CDPOS (KRED) | FK03 → Display Changes | Bank account, IBAN, payment terms, address modifications |
| MM | Batch Traceability | CHVW + MSEG | MB56 / MCHB | Forward and backward trace of every batch through supply chain |
| SD | Sales Document Flow | VBFA + VBAK + VBRK | VA03 → Document Flow | Complete chain from quotation to SO to delivery to billing to payment |
| SD | Pricing Condition Changes | KONV + CDHDR | V/LD / ME23N | Manual price overrides, discount additions after order creation |
| HR | Infotype History | PA000x (all records per PERNR) | PA03 / PA20 | Every salary, bank, position, and leave change with effective dates |
| HR | HR Change Documents | CDHDR (PERSDATA) | PA03 → Change Documents | User and timestamp for every infotype modification |
| QM | Digital Signature Log | DRAD | QA32 / QA11 → Signature Log | 21 CFR Part 11 / GMP Annex 11 - who signed what, when, with what reason |
| QM | Inspection Results History | QALS + QAVE + QASR | MCXC / QA32 | Complete test history per batch, characteristic, and time period |
| PS | Project / WBS Changes | CDHDR (PROJ / PSPHI) | CJ20N → Change Documents | Budget increases, date changes, responsible person modifications |
| SYS | User Access Log | SM20 / STAD | SM20 / SUIM / SM21 | Every logon, T-code executed, authorisation failure - all users |
| SYS | Transport Changes | E07T + E071 | SE10 / STMS | Configuration changes promoted to production - who approved, when |
| Audit Scenario Question | Key SAP Approach | Tables / T-Codes |
|---|---|---|
| A vendor invoice was paid twice. How do you investigate? | Check BSAK for duplicate clearing docs. Check REGUP for payment run. Identify the FI document and reversal history in BKPF. | FBL1N · BSAK · REGUP · FB03 |
| A PO price was changed after GR but before invoice. Who changed it and when? | Query CDHDR (OBJECTCLAS=EINKBELEG) + CDPOS (FNAME=NETPR) for the PO number. Compare UDATE vs GR date from MKPF. | SE16N on CDHDR + CDPOS · ME23N Changes |
| An employee claims their salary was reduced without approval. How do you prove it? | Display all PA0008 records for the PERNR - history shows old and new values. PA03 shows which user made the change and when. | PA20 · PA03 · CDHDR (PERSDATA) |
| How do you prove a material document cannot be modified after posting? | Open any MSEG record in SE16N - try to modify it (system blocks). Show that only a counter-movement (reversal) via MIGO creates a new document - original remains intact. | SE16N on MSEG · MB51 · MIGO (102 reversal) |
| An external auditor wants proof that no config was changed in production without approval. | All production config changes require a transport request (SE10). The STMS log shows every transport released, approved by whom, and imported when. | SE10 · STMS · E07T · E071 |
📘 Related SAP Tutorials
SAP All Tables List
Complete reference to 100+ SAP database tables across all modules with key fields, descriptions and primary keys.
Read TutorialSAP Real Business Scenarios
End-to-end SAP business process walkthroughs - P2P, O2C, R2R, H2R, Plan-to-Produce and more with full T-codes.
Read TutorialSAP FICO Interview Questions
Top 50 advanced SAP FICO interview questions with real examples covering GL, AP, AR, Asset Accounting and CO.
Read Tutorial