How to use user exit in substitution and validation rules?
Introduction
We know that substitution and validation rules are used to validate and substitute data from master data & transactional data in SAP Finance Module. It is widely used in across sub-modules as it gives more flexibility to functional consultant further to end users via set maintenance.
I am presuming that you already know about substitution & validation rules, if not you can learn through these slides to understand basics of validation & substitution rules.
Steps in validation & substitution rule:
Validation–
- Prerequisite
- Check
- Message
Substitution –
- Prerequisite
- Substitute
We can easily understand the function of both rules with below diagram:

We have option to put user exit in check step of validation and substitute step of substitution
So prerequisite remains open for use in both cases, so once the prerequisite rules are being match then only user exit will trigger to make changes (substitution) or to decide whether error msg should be displayed or not (validation)
Validation & Substitution rule transaction codes
You can remember transaction codes in below sequence
GGB0 – Validation rule creation
GGB1 – Substitution rule creation
GGB4 – Assignment of Validation & Substitution rules
These three transactions you all need for validation & substitution rules.
How to check user exit in validation/substitution
Let’s go to GGB0

This is one validation rule, where in check step, user exit ZEVAL is used.
By clicking on check, you can go inside check condition:

Select the user exit and click on ABAP Routine (as mentioned above)
And you will be redirected to the section code for this user exit.

Also Read: Everything about OB52 authorization group
Here you can setup breakpoint, to debug the errors or to find out how user exit is working.
But this should be somewhere assigned, for system to know which program to check for user exit. And that we will see now.
How to create user exit for substitution and validation in SAP FICO?
In GGB0/GGB1 transactions, we have predefined list of user exit to select from. But that should be created somewhere, right?
Go to transaction GCX2

In this transaction code GCX2, you have to assign GBLR (Validation) & GBLS (substitution) Application area to z programs in which ABAPer will be writing code for all user exits.
To create z program, you can copy standard program RGGBR000
ABAP team will write user exit name in subroutine ‘GET_EXIT_TITLES’,
Under user exit code will be written as per the specification / requirements.
So in our example we used user exit ZEVAL. This name will be written in program assigned above in (GCX2). In this program there will be blocks of code for multiple user exits. In our case system will only run the program block of code written for ZEVAL user exit.
This is how user exit is link to program and it is used in substitution and validation rules.
This brings us to an end. Hope you enjoy and learn something. We publish such blogs once in every week, if you want to get notified of new blogposts, then you can register to below newsletter: