top of page

Validation and Substitution in SAP S/4 HANA

What are Validations in SAP ?

  • Validations are rules or conditions defined by the organization that the system must follow to accept or reject transactions, postings or master data entries.

  • When you're entering a transaction in SAP, the system checks if the combination you've entered meets the rules defined for it. If it matches those rules, the transaction goes through without a hitch. But if the combination doesn't meet the requirements set then it'll give you an error message, saying you can't proceed with that combination, you'll be stopped until you fix it.

  • Validations can be created for several modules like Financial Accounting, Asset accounting, Cost Accounting, etc.

How to Configure Validations in SAP ?

Let's consider an example :

While posting a Journal Voucher via T.Code FB50 (G/L Document Posting) in my company code BAJAJ, if Document date is greater than Posting date then system must give an Error message i.e., 'Document date must be same as Posting date' and allow to post only Document date is less than or equal to Posting date.

STEP 1 : Go to Transaction code - GGB0, click on Document Header (call-up point).

Call-up Points - refers to different levels within a document where validations or checks can be triggered. The call up points are Document Header, Line Item and Complete document.


Validation and Substitution in SAP

STEP 2 : Select Document header and click on Validation icon,

Validation and Substitution in SAP

STEP 3 : Provide the New validation name and SAVE.

Validation and Substitution in SAP

STEP 4 : Click on Step, to create Step 001 for New Validation Condition. There can be several Step in a single validation


Every Step follow this three step process - Prerequisite > Check > Message

(1) - Prerequisite : defines the conditions that must be met for the validation to be executed

(2) - Check : If the check evaluates to true, the condition is met, the validation is successful.

(3) - Message : notification generated based on the outcome of the checks.

Validation and Substitution in SAP

STEP 5 : Click on Prerequisite,

In Table Fields tab >> Click on "ABAP system fields" to select Transaction code (FB50 ) and "Accounting Document Header" to select BKPF table Field (Company Code).

Validation and Substitution in SAP
  1. Field box where condition is defined.

  2. Table Field consists of ABAP System Fields & Accounting Document Header Fields.

  3. Formula Builder - to process mathematical formulas for Boolean logic(=, +,<, >, etc.)

  4. Constant - To input value fields.

  5. Element is to delete any particular selected field.

Validation and Substitution in SAP

as per our example, we required a pre-condition where the Transaction Code is 'FB50' and company code is 'BAJA'

Validation and Substitution in SAP

STEP 6 : Click on Check to verify, that Document Date must be less than Posting Date.

Validation and Substitution in SAP

STEP 7 : Click on Message, to give a notification to user if the check is not met.

Select Message Type like Warning (W), Error (E), Cancel (A) or Information (I) and then select the message number with pre-defined message, or

>> Click on pencil icon to create a message as shown below

Validation and Substitution in SAP

Now, select the number like '088' and click on selected entries to edit and enter message "Document Date must be same as Posting Date"

Validation and Substitution in SAP

Here, choose your message number and SAVE.

Validation and Substitution in SAP

Validation Step 001 of BAJAJ saved :-

Validation and Substitution in SAP

To Validate Accounting Documents ( T.Code OB28)

To assign the Validation for your company Code, You can maintain one validation per one call up point only. But under one validation you can create multiple steps to be performed during doc entry.


STEP 1 : Go to Transaction Code OB28 and click on New Entries,

Validation and Substitution in SAP

STEP 2 : Enter Company code, Callup point, Validation, Action Level (Active/Inactive) > SAVE

Validation and Substitution in SAP

Test result of the above Validation Rule in FB50 Screen -

As seen below Document Date is greater than Posting Date hence system is showing message to make user enter Document date same as Posting date to post.

Validation and Substitution in SAP


What are Substitutions in SAP ?

  • Substitutions is a functionality in SAP that is used to automatically replace or modify data values in SAP documents, transactions, or reports based on predefined conditions.

  • Substitutions are triggered based on predefined conditions, which are typically defined using a combination of fields, values, formulas, and logical expressions. These conditions determine when the substitution should be applied.

  • Substitutions can be created for several modules like Financial Accounting, Asset accounting, Cost Accounting, etc.

How to configure Substitutions in SAP system ?

Let's consider an example :

If a user is posting any JV via T-Code FB50 (G/L Document Posting ) and if its company code is BAJAJ, then system must replace or fill the Text field of line items with 'Test Journal Voucher'.


STEP 1 : Go to Transaction Code GGB1, Select Line Item and click on Substitution to create Step. Similar to the Validation callup points, here also we have Document header, Line item, Complete Document and cost of sales accounting.

Validation and Substitution in SAP

STEP 2 : Click on Step to create new substitution, provide code with description and Save.

Under a Substitution there can be multiple step, and the step first checks condition (prerequisite) and replace (substitutes) with value.

Validation and Substitution in SAP

STEP 3 : Create Condition with provided fields of Document header, line item and ABAP fields, formula builder, constants etc.

In our case, if T Code is "FB50" and Company code is "BAJA" then system must replace the BSEG table 'Text' field.

Validation and Substitution in SAP

STEP 4 : Select substitution then click on Insert substitution entry (+) > select Field 'SGTXT'.

Validation and Substitution in SAP

and then, click on Constant values to provide value manually.

Validation and Substitution in SAP

You enter the value ' Test Journal Voucher', that is to be transferred to the assigned recipient field. This value is also allowed to be blank.

Validation and Substitution in SAP

Substitution Step 001 of BAJAJ saved :-

Validation and Substitution in SAP

To Substitute in Accounting Document ( T.Code OBBH)

To activate the Substitution rule for your company code.


STEP 1 : Go to Transaction Code OBBH and click on New Entries,

Validation and Substitution in SAP

STEP 2 : Enter Company code, Callup point, Substitution, Action Level and SAVE

Validation and Substitution in SAP

Test result of the above substitution rule in FB50 Screen -

As seen below, while Posting JV in BAJAJ the system replaces the user Text field with provided Substitution Text.

Validation and Substitution in SAP

Validation and Substitution in SAP are functionalities used to enforce business rules and automatically modify data entered in SAP system, throughout this blog, we've delved into the significance of these functionalities.

Validation rules act as gatekeepers, preventing incorrect or incomplete data from entering the system. On the other hand, substitutions offer a flexible mechanism to automatically adjust data according to predefined rules, thus reducing manual intervention.


Thank you for taking the time to read my blog. I appreciate your support and hope you found this content valuable. Stay tuned and follow me for more insightful articles in future.




UPCOMING SAP S4 HANA ONLINE BATCHES - GET UPTO 30% Discount


SAP Controlling - 20th April'24 @8:00AM, IST


SAP S4 HANA FICO - 07th May'24 @8:00PM, IST


SAP Sales & Distribution (SD) - 27th April'24 @8:00AM, IST


SAP EWM - 8th April'24 @9AM, IST





Recent Posts

See All
bottom of page