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.
STEP 2 : Select Document header and click on Validation
STEP 3 : Provide the New validation name and SAVE.
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 3 step process : Prerequisite > Check > Message
- Prerequisite : defines the conditions that must be met for the validation to be executed
- Check : If the check evaluates to true, the condition is met, the validation is successful.
- Message : notification generated based on the outcome of the checks.
- Formula Bar : where condition is defined.
- Table Field : consists of ABAP System Fields & Accounting Document Header Fields.
- Formula Builder : to process mathematical formulas for Boolean logic.
- Constant : to input value fields.
- Element : is to delete any particular selected field.
as per our example, we require a pre-condition where the Transaction Code is 'FB50' and company code is 'BAJA'
STEP 6 : Click on Check > To verify Document Date under "Document Header field" must be less than Posting Date.
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
Now, select the number like '088' and click on selected entries to edit and enter message "Document Date must be same as Posting Date"
Here, choose the message number and SAVE.
Validation Step 001 of BAJAJ
STEP 1 : Go to Transaction Code OB28 and click on New Entries,
STEP 2 : Enter Company code, Callup point, Validation, select Action Level as Active and SAVE.
How to configure Substitutions in SAP system ?
Let's consider an example :
If a user is posting any JV via T-Code FfbB50 (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 2 : Click on Step to create new substitution, Enter code for substitution with description and Save.
Under a Substitution there can be multiple step, and the step first checks condition (prerequisite) and replace (substitutes) with value.
Press button “Step” to create new step.
System pop-up window for you to choose a field that you need to do a substitution.
You may not found many fields in this step. Because SAP exclude these field for substitution. But it doesn't mean that you cannot select these fields. SAP launch a SAP Note for specific requirement to activate some fields for substitution. Please check SAP Note 42615.
STEP 4 : 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.
Enter text 'Test Journal Voucher', that is to be transferred to the assigned recipient field. This value is also allowed to be blank.
To activate the Substitution rule for your company code.
STEP 1 : Go to Transaction Code OBBH and click on New Entries,
STEP 2 : Enter Company code, Callup point, Substitution, Action Level and SAVE
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 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.
---------------------------------------------------------------------------------------------------------------------------
How to add a particular field in the substitution rules - GGB1
There are times when we need to use the substitutions for particular fields but they are unavailable. This requires a small effort from our end to include the requisite field for the substitution rules. Here I would provide the steps, which will make things easier to understand.
1. Check if the field that needs to be substituted is already present or not.
2. If it is not present, go to SM30. Select the table VWTYGB01. Click on Maintain. For example, say the field cost center (KOSTL) needs to be substituted.
This field will have the "Exclude" check box checked. Hence this is not present in the variables that can be substituted.
3. Uncheck the “Exclude” checkbox for the requisite field. Since this field has been excluded, this is not showing up during the field search in substitution. Save it.
4. Run the program RGUGBR00 via SE38
and execute it.
The following showcases the selections that need to be made for running the program and including
the appropraiate variables (in this case KOSTL).
5. The field KOSTL will get added to the substitution rules. Now this can also be used for substitution as and when required.
This way we can add different fields which may not be available for subtitution initially. All the fields that can be used for substitution, from different tables, are provided in the table VWTYGB01.
Comments
Post a Comment