User exit is a functionality provided by SAP to add custom
validation or enhancements to existing SAP transaction. Every module pool has
customer function FORM in PBO and PAI. This form is basically a function
that has an INCLUDE object, for eg. INCLUDE ZXPADU01. User can
include enhancements or source code, that will be
triggered during execution of this transaction.
For eg. all HR infotype program (module pool) starts with
the name MPnnnnnn. So infotype 0001 module pool name will be
MP000000. Search for string 'customer_function' and you will
find two FORM under each module pool. PERFORM
customer_function_pbo(sapfp50m) and PERFORM
customer_function_pai(sapfp50m). Place your cursor on 'customer_function'
and double click. It will take you to 'FORM
customer_function_pbo'. In this form you should see a CALL
CUSTOMER-FUNCTION '001' function module. Double click on '001'
and you can see SAP has provided an INCLUDE object, for eg.
INCLUDE ZXPADU01. You can add your logic in this object
ZXPADU01 and at runtime when you enter data in the respective
infotype for eg. 0000, the validation included in the object
will be executed.
Execute transaction CMOD to
define Project that contains User Exit.
Here is an example of HR Benefit USER EXIT:
Enter Project name, for eg. ZBEN0003, select option 'Enhancement assignment' and
enter for eg. PBEN0003 (name of SAP enhancement
object). Click on 'Components' button and the screen
will display 'EXIT_SAPLHRBEN00FEATURE_003'. Double click on
this object and it will take you to FUNCTION
EXIT_SAPLHRBEN00FEATURE_003. There will be an INCLUDE object
starting with name 'Z' in this function module that you can
update with your custom logic.