Summary -
In this topic, we described about the below sections -
User exits instructs system to access a program during the system processing. User exits allows to add additional functionality to the application program without modifying it.
User exits are commonly used in Sales and Distribution (SD) modules. User exits implemented in the form of subroutines. User exit is a three-digit code and user exits called as FORM Exits.
The three-digit codes like SXX or UXX where XX represents a two-digits number. If a code starts with S letter, it is a standard user exit defined by SAP. If a code starts with U letter, it is a custom user exit defined by a user.
A user exit is intended to make changes when standard SAP program is not capable of fulfilling all the requirements. User exits are subroutines and user exits can upgrade but not reusable.
The actual user exits exist in includes and those are assigned to module pool. The user exits attached to the application program by using INCLUDE statement.
The user exit is implemented as a call to the function module. The naming standard for function module exits is: EXIT_<program name><3 digit-suffix>.
The call to a function module exit is implemented as: CALL CUSTOMER-FUNCTION <3 digit-suffix>. All user exits start with the word USEREXIT_...
FORM USEREXIT_..
...
ENDFORM.
User Exits | Description |
---|---|
USEREXIT_FIELD_MODIFICATION | Used to modify screen attributes. |
USEREXIT_SAVE_DOCUMENT | Used to perform operations when the user hits Save. |
USEREXIT_SAVE_DOCUMENT_PREPARE | Used to check input fields or show a popup to users and to confirm the document. |
USEREXIT_MOVE_FIELD_TO_VBAK | Used when header changes are moved to header work area. |
USEREXIT_MOVE_FIELD_TO_VBAP | Used when item changes are moved to SAP item work area. |
Example -
Simple example to create enhancement in the user exit.
To add enhancement to the existing user exit. Let's take an user exit MV45AFZZ to add enhancement.
To access user exist in sales, go to IMG using this path: IMG Sales and Distribution System Modifications User Exits.
Step-1: To open IMG, go to SPRO.
Step-2: Click on SAP Reference IMG.
Step-3: Click on 'User exits on Sales' documentation to get the user exits information.
Step-4: Let us take MV45AFZZ as an user exits to enhance. Go to SE38 and click on display button.
Step-5: Click on enhance button to open the module to in edit mode first. Right click on Double Quote (") and click on Enhancement operations Create Implementation.
Step-6: Click on Code button below.
Step-7: Click on New enhancement.
Enter the new enhancement name, short text and click on Continue mark.
Step-8: Enter the package information and click on local object to create enhancement like below.
Step-9: New enhancement opens like below. Complete the code changes in between ENHANCEMENT and ENDENHANCEMENT.
Step-10: Save and activate. Execute the user exit, output displays with the new changes.