Why is Validation and Substitution rule important?
As the user sets the Validation rule, it checks the validation rule defined on specific fields data. When user is trying to post the transaction and enters data in that specific field, which violates the validation rule, system throws an error message for the user and it will not allow the transaction to post.
It will succeed to post the transaction only when the data is posted in that specific field as defined in the validation rule. It helps to avoid wrong entry at initial stage of posting the transaction.
Whereas Substitution rule is set up to substitute the data immediately upon the entry made. As the user enters the value, system validates according to the prerequisite defined by the user. If the prerequisite rule is met, the system replaces the value entered with other values.
With SAP S/4HANA Cloud 2005, The Manage Substitution/Validation Rules app for JVA is enhanced with the new comparison operator Matches and the new substitution type Table Lookup.
The Matches operator can be used to match a string-type field value against a regular expression.
The Table Lookup substitution type allows user to choose a source field from a custom business object and uses its value to fill in the target field.
Let’s see how it looks and how to configure in the Cloud System with 2005 upgrade:
Apps involved:
- Manage Substitution/Validation Rules
- Post General Journal Entries
Business Roles:
Unrestricted read/write for:
- Configuration Expert – Business Process Configuration: BR_BPC_EXPERT
- General Ledger Accountant: BR_GL_ACCOUNTANT
Example:
1. Define Validation Rule
Login with the role Configuration Expert – BPC_EXPERT
Go to “Manage Substitution/Validation Rules”
![SAP S/4HANA Cloud Public Edition Finance, SAP S/4HANA Cloud](https://i0.wp.com/www.erpqna.com/wp-content/uploads/2024/08/sap-s-4hana-cloud-validation-and-substitution-rules-1.png?resize=730%2C60&ssl=1)
Click on “Create Rule”.
![SAP S/4HANA Cloud Public Edition Finance, SAP S/4HANA Cloud](https://i0.wp.com/www.erpqna.com/wp-content/uploads/2024/08/sap-s-4hana-cloud-validation-and-substitution-rules-2.png?resize=730%2C138&ssl=1)
Enter the following:
Context: Coding Block
Event: Coding Block
Rule Type: Validation Rule
Click on “Create”
![SAP S/4HANA Cloud Public Edition Finance, SAP S/4HANA Cloud](https://i0.wp.com/www.erpqna.com/wp-content/uploads/2024/08/sap-s-4hana-cloud-validation-and-substitution-rules-3.png?resize=730%2C264&ssl=1)
Under General Information enter the following:
![SAP S/4HANA Cloud Public Edition Finance, SAP S/4HANA Cloud](https://i0.wp.com/www.erpqna.com/wp-content/uploads/2024/08/sap-s-4hana-cloud-validation-and-substitution-rules-4.png?resize=730%2C215&ssl=1)
Under Precondition, enter the following:
![SAP S/4HANA Cloud Public Edition Finance, SAP S/4HANA Cloud](https://i0.wp.com/www.erpqna.com/wp-content/uploads/2024/08/sap-s-4hana-cloud-validation-and-substitution-rules-5.png?resize=730%2C131&ssl=1)
Under Validation, enter the following:
![SAP S/4HANA Cloud Public Edition Finance, SAP S/4HANA Cloud](https://i0.wp.com/www.erpqna.com/wp-content/uploads/2024/08/sap-s-4hana-cloud-validation-and-substitution-rules-6.png?resize=730%2C331&ssl=1)
Click on “Save”.
Click on “Activate”.
![SAP S/4HANA Cloud Public Edition Finance, SAP S/4HANA Cloud](https://i0.wp.com/www.erpqna.com/wp-content/uploads/2024/08/sap-s-4hana-cloud-validation-and-substitution-rules-7.png?resize=730%2C81&ssl=1)
2. Post Journal Entry
Login with the role General Leder Accountant: GL_ACCOUNTANT
![SAP S/4HANA Cloud Public Edition Finance, SAP S/4HANA Cloud](https://i0.wp.com/www.erpqna.com/wp-content/uploads/2024/08/sap-s-4hana-cloud-validation-and-substitution-rules-8.png?resize=730%2C78&ssl=1)
Enter the following Header details.
![](https://i0.wp.com/www.erpqna.com/wp-content/uploads/2024/08/sap-s-4hana-cloud-validation-and-substitution-rules-9.png?resize=730%2C143&ssl=1)
Line Item 1: Enter the following details
![](https://i0.wp.com/www.erpqna.com/wp-content/uploads/2024/08/sap-s-4hana-cloud-validation-and-substitution-rules-10.png?resize=730%2C213&ssl=1)
Line Item 2: Enter the following details
![](https://i0.wp.com/www.erpqna.com/wp-content/uploads/2024/08/sap-s-4hana-cloud-validation-and-substitution-rules-11.png?resize=730%2C197&ssl=1)
Click on “Post”.
You should receive the below error message.
![](https://i0.wp.com/www.erpqna.com/wp-content/uploads/2024/08/sap-s-4hana-cloud-validation-and-substitution-rules-12.png?resize=656%2C214&ssl=1)
Click on OK and go to Line Item 1.
Change the Cost Center to CC_CON
![](https://i0.wp.com/www.erpqna.com/wp-content/uploads/2024/08/sap-s-4hana-cloud-validation-and-substitution-rules-13.png?resize=730%2C334&ssl=1)
Click on “Post”
![](https://i0.wp.com/www.erpqna.com/wp-content/uploads/2024/08/sap-s-4hana-cloud-validation-and-substitution-rules-14.png?resize=460%2C154&ssl=1)
3. Create Substitution Rule
Login with the role Configuration Expert – BPC_EXPERT
Go to “Manage Substitution/Validation Rules”
![](https://i0.wp.com/www.erpqna.com/wp-content/uploads/2024/08/sap-s-4hana-cloud-validation-and-substitution-rules-15.png?resize=730%2C59&ssl=1)
Click on “Create Rule”
![](https://i0.wp.com/www.erpqna.com/wp-content/uploads/2024/08/sap-s-4hana-cloud-validation-and-substitution-rules-16.png?resize=730%2C138&ssl=1)
Enter the following
Context: Coding Block
Event: Coding Block
Rule Type: Substitution Rule
Click on “Create”
![](https://i0.wp.com/www.erpqna.com/wp-content/uploads/2024/08/sap-s-4hana-cloud-validation-and-substitution-rules-17.png?resize=730%2C257&ssl=1)
Under General Information, enter the following:
![](https://i0.wp.com/www.erpqna.com/wp-content/uploads/2024/08/sap-s-4hana-cloud-validation-and-substitution-rules-18.png?resize=730%2C191&ssl=1)
Under Precondition, Enter the following:
![](https://i0.wp.com/www.erpqna.com/wp-content/uploads/2024/08/sap-s-4hana-cloud-validation-and-substitution-rules-19.png?resize=730%2C131&ssl=1)
Under Substitution, Enter the following:
Substitute Type: Substitute with Constant
![](https://i0.wp.com/www.erpqna.com/wp-content/uploads/2024/08/sap-s-4hana-cloud-validation-and-substitution-rules-20.png?resize=730%2C333&ssl=1)
Click on Save.
Click on Activate.
![](https://i0.wp.com/www.erpqna.com/wp-content/uploads/2024/08/sap-s-4hana-cloud-validation-and-substitution-rules-21.png?resize=730%2C63&ssl=1)
4. Post Journal Entry
Login with the role General Ledger Accountant: GL_ACCOUNTANT
![](https://i0.wp.com/www.erpqna.com/wp-content/uploads/2024/08/sap-s-4hana-cloud-validation-and-substitution-rules-22.png?resize=730%2C78&ssl=1)
Enter the following Header details.
![](https://i0.wp.com/www.erpqna.com/wp-content/uploads/2024/08/sap-s-4hana-cloud-validation-and-substitution-rules-23.png?resize=730%2C143&ssl=1)
Line Item 1: Enter the following details
![](https://i0.wp.com/www.erpqna.com/wp-content/uploads/2024/08/sap-s-4hana-cloud-validation-and-substitution-rules-24.png?resize=730%2C276&ssl=1)
Line Item 2: Enter the following details
![](https://i0.wp.com/www.erpqna.com/wp-content/uploads/2024/08/sap-s-4hana-cloud-validation-and-substitution-rules-25.png?resize=730%2C341&ssl=1)
Click on Post.
Click on Display.
![](https://i0.wp.com/www.erpqna.com/wp-content/uploads/2024/08/sap-s-4hana-cloud-validation-and-substitution-rules-26.png?resize=463%2C154&ssl=1)
Click on Settings
![](https://i0.wp.com/www.erpqna.com/wp-content/uploads/2024/08/sap-s-4hana-cloud-validation-and-substitution-rules-27.png?resize=730%2C107&ssl=1)
Select Functional area and click on OK.
![](https://i0.wp.com/www.erpqna.com/wp-content/uploads/2024/08/sap-s-4hana-cloud-validation-and-substitution-rules-28.png?resize=730%2C509&ssl=1)
![](https://i0.wp.com/www.erpqna.com/wp-content/uploads/2024/08/sap-s-4hana-cloud-validation-and-substitution-rules-29.png?resize=730%2C85&ssl=1)
Functional Area is YB20 which proves Substitution Rule has been triggered correctly.
With this the user can successfully create and validate the rules as per business requirements.