How to create Substitutions with user exit

T-Code GGB1

GO TO SAP Transaction sm30 and open table V_T80D.

in the below application area copy the standard program and replace by the Z program which you have created
GBLR RGGBR000 Val/sub: Exits for rules
GBLS RGGBS000 Val/sub:Exits for substitution

When you copied program it would have copied the below form as well
FORM get_exit_titles TABLES etab in this you need to create your enter the Exit no which you whish to use.

I prefer starting from 900, below way data needs to be passed in it

exits-name = ‘U900’. “single validation: only one
exits-param = c_exit_param_none. “data record used
exits-title = text-105. “Example EIS
APPEND exits.

“In case of validation this format is used
FORM u901 CHANGING p_res00.
p_res00 = ‘T’. If the validation is true
p_res00 = ‘F’. I fthe validation is false, I will show the message configured in validation
ENDFORM.

“In case of Subsitution
Directly update bseg-<field>
FORM u900.
bseg-gsber = ‘ABC’.
ENDFORM.

if you want a new field which needs to be added in substitution then
Yon do it by adding the field in SM30: VWTYGB01 reflect in (GB01).

Activation or regenration of program if the code is workinng
RGUGBR01