Hello everyone, I am writing my first blog on the validation rules which is very critical and very important to validate a business process component without or limited support from the technical resources in the ECC as well as S4 HANA. This topic is based on defined in the S4 HANA system.
So what are Validations? validations are hard checks that get called when a user/system posts any transaction into FI (and other areas like controlling, asset accounting, PS module, etc.). You can set them up to be called automatically at the Document Header level, at the Line Item level, and for the complete document. These checks are created in transaction GGB0 and activated for Finance in transaction OB28 for the respective company code. It restricts the transactions from posting that have data that does not meet your business rules.
I am creating validation for the transaction code FB60 in the S4 HANA system with an example of 'restricting a Document type ZP - Payment document type to be posted through FB60 Transaction code. This is a very basic example, one can refer to the below steps and create new validation for your business requirement.
Configuration steps:
Step 1: Create a validation folder in the respective business process in the GGB0 Transaction code. I am creating validation for the document type, so document header validation. I selected the Financial accounting -> Document header.
Keep the cursor on the 'Document header' and click on the validation button.
Give validation name and description.
Step 2: Under your own validation folder, you define all validations for your company which fall under FI and Document header level.
To create a rule for the example of restricting document type ZP to the transaction code FB60, please select the validation folder created in step1 and click on the rule button.
In this rule, you have to define below three rules for your validation
- Prerequisite: Validation condition base requirement. In my example, I am giving a condition where this validation will be called when a user enters the transaction code FB60
- Check: The rule you configure in this step will be checked for the validating your validation rule. i.e Once the user enters into transaction code FB60, then the system will check the value in the filed BKPF-BLART (Document header and document type), so the system will check if the document type is ZP or not if the entry is ZP, this validation will be checked.
- message: If above both conditions met, the message type and message text will be displayed. Message can be a Cancel, information, warning message, and error (hard stop).
Step 3: We can use a message number if the existing message matches the validation, if not we have to define a new message. Message can be defined in the T code SE91 or we can go to a change option beside Message class option from validation screen.
To create a message from the validation screen, go to 'message' and click on the change button beside Message class to create a new message for validation.
Step 4: Enter the short text of the error message to be displayed on the screen when a validation rule is met.
Step 5: To maintain a long text, click on 'Long Text'. This will open a form in word format.
We can define the longs text in the word form or in the editor option.
Step 6: Go to 'Goto' and click on 'Change Editor'.
Once a pop-up window appears, please click on no to save the predefined rules. It is better to define the entire message from the beginning.
Step 7: To enter a detailed explanation of the error message, select
I1 in the format. Write the message in the
Row Text
Here we can describe our short message in detail.
If it required to give space between the 1st paragraph to 2nd, please place a cursor in the empty line after the first paragraph line and click on the 'Line' option. Which will allow enabling filed to select the format.
Select the '/' symbol in format to give space between lines.
Step 8: Select format
U1 for the Heading. Below the headline, you can provide more details and click on save.
Step 8: Click on the 'Screen Output' button to display the message.
Click on the activate button and go back to the validation by clicking the back button.
step 9: Go to T code OB28 and assign the validation to the company code and activate it.
Now let us test the validation created above.
Go to transaction FB60 as the validation is defined for the Transaction code FB60.
After entering mandatory fields like company code, reference number, invoice date, change the document type to ZP.
When we change the document type to ZP, a validation rule will be triggered i.e. System will check the transaction code FB60 from prerequisite setup and will check the condition of ZP if both conditions met, a message will;l be displayed as defined in the message option.
To view the long text of the error message, click on the help button (question mark).
A detailed long message will be displayed as designed for the message configuration. Which is similar to the SAP standard error message displayed for any error messages.
SAP S4HANA validation will help to define rules to validate the predefined rules and will help the business to avoid data errors.
Thank you
Devendar Bukya