If you want to insert ABAP logic into your validation, you need validation user exit. Below is way to create validation user exit.
Step 1 . Copy program RGGBR000 to ZRGGBR000.
Step 2. Write ABAP Code to implement new user exit name within subroutine GET_EXIT_TITLES.
exits-name = 'ZFI01'. "matrix validation:
exits-param = c_exit_param_none. "complete data used in exit.
exits-title = TEXT-104. "Example EIS
Note : You can named your user exit on EXITS-NAME = <Your user exit >.
Step 3. Create user exit sub routine. below the example ABAP Code, you can write your own ABAP code based on the requirement. then activate it.
FORM zfi01 USING b_result.
b_result = 'X'.
"-- your ABAP Logic
b_Result = ''.
Step 4. Assign ZRGGBR000 in GCX2 tcode.
Step 5. Create your validation using tcode GGB0.
If you have assigned custom program in Step 2 before, your user exit subroutine will appear here on tab Exits. See that picture above.
Write your subroutine user exit name into Check input text field like thats picture.
Step 6. Maintain Message in Validation.
Step 7. Activate your validation in tcode OB28, entered your company code and your validation name.