Customer exits acts as ‘Hook’ for the custom functionality to meet business requirements.
SAP creates customer exits for specific programs, screens and menus within standard R/3 applications.
Customer exits are used for creating additional fields or menu items to standard transaction code. Customer exits are function modules and can upgrade. Customer exits are reusable.
Customer exits do not contain any functionality.
There is no need to modify the SAP standard program and not required an access key to write the code.
These customer exits don’t have any functionality and they are empty. Customer exits may not available for all programs.
Customer Exits Types –
Customer exits are three types and those are –
- Function Module Exits
- Screen Exits
- Menu Exits
Function Module Exit –
Function Module Exit allows adding code via function module. The function module call can be coded at the specific location in the application program via function module.
CALL CUSTOMER-FUNCTION '<3 digit suffix>'
Screen Exit –
Screen Exit allows to add fields to a screen in SAP program via a sub screen. The sub screen is called within the standard screen’s flow logic.
CALL CUSTOMER-SUBSCREEN Screen-exit-name
Menu Exit –
Menu Exit allows to add items to a pulldown menu in a standard SAP program. These items used to call as add-on programs or custom screens.
+CUS ( additional item in GUI status )
Example –
Simple example to create customer user exit for VA01 transaction.
To create a customer user exit, we need to have enhancement name in handy. The below process is to get the enhancement name for VA01 transaction.
Step-1: Go to SE93 transaction and enter transaction code as VD01.
It displays Display Dialog Transaction screen with the details like below.
Step-2: Place the cursor on SAPMF02D and double click on the program to get open.
Step-3: Click on the find and enter the text as ‘CALL CUSTOMER-FUNCTION’. Click on Continue icon to start text.
Step-4: The result gets displayed like below. Click on ‘CALL CUSTOMER-FUNCTION’ to get open in Edit mode.
Step-5: Place the cursor on ‘001’ and double click on it to get the function module get opened like below.
Step-6: Once we got the function module(EXIT_SAPMF02D_001), then go to SE11 transaction to get the enhancement details.
Table MODSAP has the enhancement details along with function modules. Click on display button.
Step-7: Click on contents and enter member name as EXIT_SAPMF02D_001 and execute.
Step-8: The result displays the enhancement name like below –
Create customer user exit –
Step-1: Go to CMOD transaction. Enter the Project name and click on create button.
Step-2: Enter the Short text and click on save button.
Enter the package details in the next screen and click on Local Object button.
Step-3: Click on Enhancement assignments to enter enhancement details and click on save button.
Step-4: Click on Components to get the enhancement details. Double click on function exit EXIT_SAPMF02D_001 to open the source code.
Step-5:Double click on INCLUDE to add the code changes. Add the below code to the INCLUDE ‘ZXF04U01’.
IF i_kna1-land1 = 'IN'.
MESSAGE 'Customer From India' TYPE 'I'.
ENDIF.
Step-6:Save and activate it.
Verifying the changes –
Step-1: Go to VD02 transaction. Enter the customer as 1 and click on Continue.
Step-2: It displays the information like below.
Once the LAND1 changed to IN, the below mesg will be get displayed.