After knowing about user exits in sap abap, its time to find one and implement it. As you know user exits mostly exits in Sales and distribution module.Lets take a sample scenario and try to implement user exist.
Scenario
While creating a sale-ale settingss order in VA01-创建销售订单, you need to through a error message if the quantity of order is > 100.00. To find the user exits available while creating VA01-创建销售订单.
Approach-1
1. Enter VA01-创建销售订单 in command bar to go to transaction and then click on System → Status.
2. Pick the program name in the below popup.
3. Display the same program in SE38-ABAP编辑器.In our case the program is SAPMV45A and click on search button.
4. Enter the search string “USEREXIT_ ” in the below popup and click in OK.
5. you will get the screen like below with search results. From them choose the correct one to write the code.You can choose the correct use exits by reading the documentation available in every subroutine.In our case i have chosen user exit USEREXIT_SALVE_DOCUMENT_PREPARE in the include MV45AFZZ.
[adsenseyu1]Approach-2
1. Go to SE80-Object Navigator, select Package and put VMOD and press enter. All the includes under this package contains many user exits and choose the correct one to fit your requirement.
You can choose any the above approaches to find the user exit. You can find the full documentation of each and every user exit here.
Implementation
Go to the include MV45AFZZ in SE38-ABAP编辑器 and then the subroutine USEREXIT_SAVE_DOCUMENT_PREPARE to write the below code.