Why do we use validation instead of configuration?/What is the purpose of SAP validation rules ?

 SAP validation rules ensure data integrity by defining criteria that must be met before a document can be saved.

They help enforce business rules, preventing incorrect or inconsistent data entry.

Standard SAP configuration like document type settings applies at client level and affects all company codes. If a business requirement is specific to a company code, we use validation to control the logic based on conditions such as company code, document type, or field values. Validation allows us to enforce rules dynamically and restrict postings by throwing error messages when conditions are not met.

1. What is Validation in SAP?

Q1. What is Validation?

Answer

Validation is used to control data entry by throwing an error/warning message when certain conditions are met.

👉 It stops the document posting if conditions are violated.


2. What is Substitution?

Q2. What is Substitution?

Answer

Substitution is used to automatically replace field values during document processing.

👉 It does NOT throw an error
👉 It changes the value automatically


3. Key Difference (This is where most people fail)

ValidationSubstitution
Throws error/warningChanges value automatically
User must correct manuallySystem corrects automatically
Controls incorrect entriesAuto-fixes entries


4. Where Validation Works (Important Concept)

Q3. Where can we apply validation in SAP FI?



Validation works only during document posting:

  • Header → BKPF

  • Line Item → BSEG

  • Complete Document → BKPF + BSEG

❌ Not applicable for:

  • Vendor master creation

  • Customer master

  • Other master data

👉 This is a very common trap question


5. Your Scenario (Real Interview-Level Example)

Q4. Explain a practical validation scenario

Answer

Requirement:

Reference number and document header text field should be mandatory ONLY for company code 6310

Problem:

  • If we set it in document type (OBA7) → applies to ALL company codes ❌

  • Requirement is company-specific

Solution:

👉 Use Validation


6. Validation Logic (Most Important Part)



Step 1 – Prerequisite

Company Code = 6310
AND
Document Type = SA

Step 2 – Check Condition

Reference Field = Blank

Step 3 – Message

"Reference is mandatory for company code 6310"

7. Process Flow (Very Important for Explanation)

User posts document (FB01)

→ System checks validation

IF condition satisfied:
→ Throw error message
→ Stop posting

ELSE:
→ Continue posting
→ Update database (BKPF / BSEG)





8. Configuration Steps

  • Go To "FB01"

  • Click on company code field and press "f1" and note down technical field name"BKPF-BUKRS"

  • Click on document type field and press "f1" and note down technical field name"BKPF-BLART"

If condition is satisfied, then Go and check
  • Click on Document header text field and press "f1" and note down technical field name "BKPF-BLTXT"

Perquisite

BKPF-BUKRS = 6310 and
BKPF-BLART = SA

Check:
BKPF-XBLNR <> space

empty:
Error message

Please Reference No in Ref. Field

Step 1: Create Validation

GGB0
  • Application Area → FI (header section)

  • Call Point → Financial Accounting - > Document Header

  • Create Validation + Step

  • Validation name = Z6310 ; Validation for 6310 COCD                               Press Enter

  • Select Validation "Z6310" and then click on step

  • Click on "Prerquist"

  • Click on Tab "Table fields" -> Go to section " List of structures" - >click on field "structure BKPF"

  • Click on search field :

  • BKPF-BUKRS = 6310 and
    BKPF-BLART = SA
    • Go to check "2 Check"

  • Click on Tab "Table fields" -> Go to section " List of structures" - >Double click on field "structure BKPF"

Seach reference field"BKPF-XBLNR"
BKPF-XBLNR<>" "
    • Go to Message and then click on message edit button"Maintain Message"

    • Find the empty place line Message number "39"and double click and write message " For Company code: 6310 Reference is mandatory

    • Click on save

    • Message number field = 39


Step 2: Activate Validation

OB28

Click on New Entries
  • CoCd = 6310

  • CallPnt = 1 (Header)

  • Validation = Z6310

  • Activation level = 1(Active)

  • Click on save and post


Step 3: Test

FB01
  • Company Code 6310 → Error shown ✔

  • Other company codes → No error ✔


9. Key Learning (Consultant-Level Insight)

👉 Configuration at document type level = Client level impact
👉 Validation allows company-specific control

This is why validation is used in real projects

Comments

Popular posts from this blog

What is General Ledger Master Data creation and deletion ?

What is a Chart of Account and how to assign to company code in SAP FICO ?

Reconciliation Accounts and G/L Master Data Creation in SAP S/4HANA – A Complete Beginner’s Guide