User exits are used in an extraction if the standard SAP extractors do not provide the expected data or the required functionality, for instance in authorizations or time checks. User exits are commonly used in Sales and Distribution (SD) modules. There are many exits provided by SAP in the areas of sales, transportation, shipping and billing. A user exit is designed to make some changes when standard SAP is not capable of fulfilling all the requirements.
To be able to access what exits are available in each area of sales, go to IMG using this path: IMG → Sales and Distribution → System Modifications → User Exits. The documentation for each exit in the areas of SD is explained thoroughly.
For instance, if you want to find user exits in Sales Document Processing (contract, quotation or sales order), follow the path mentioned above and continue to expand the node User Exits in Sales → User Exits. Click on icon documentation to see all user exits available in Sales Document Processing.
S.No. | User Exit & Description |
---|---|
1 | USEREXIT_FIELD_MODIFICATION Used to modify screen attributes. |
2 | USEREXIT_SAVE_DOCUMENT Helps in performing operations when the user hits Save. |
3 | USEREXIT_SAVE_DOCUMENT_PREPARE Very useful to check input fields, put any value in the field or show a popup to users and to confirm the document. |
4 | USEREXIT_MOVE_FIELD_TO_VBAK Used when user header changes are moved to header work area. |
5 | USEREXIT_MOVE_FIELD_TO_VBAP Used when user item changes are moved to SAP item work area. |
A User Exit serves the same purpose as Customer Exits but they are available only for the SD module. The exit is implemented as a call to a Function Module. User Exits are modifications to SAP standard programs.
REPORT ZUSEREXIT1. TABLES: TSTC, TSTCT, TADIR, TRDIR, TFDIR, ENLFDIR, MODSAPT, MODACT. DATA: JTAB LIKE TADIR OCCURS 0 WITH HEADER LINE, field1(30), v_devclass LIKE TADIR-devclass. PARAMETERS: P_TCODE LIKE TSTC-tcode OBLIGATORY. SELECT SINGLE * FROM TSTC WHERE tcode EQ P_TCODE. IF SY-SUBRC EQ 0. SELECT SINGLE * FROM TADIR WHERE pgmid = 'R3TR' AND object = 'PROG' AND obj_name = TSTC-pgmna. MOVE TADIR-devclass TO v_devclass. IF SY-SUBRC NE 0. SELECT SINGLE * FROM TRDIR WHERE name = TSTC-pgmna. IF TRDIR-subc EQ 'F'. SELECT SINGLE * FROM TFDIR WHERE pname = TSTC-pgmna. SELECT SINGLE * FROM ENLFDIR WHERE funcname = TFDIR-funcname. SELECT SINGLE * FROM TADIR WHERE pgmid = 'R3TR' AND object = 'FUGR' AND obj_name EQ ENLFDIR-area. MOVE TADIR-devclass TO v_devclass. ENDIF. ENDIF. SELECT * FROM TADIR INTO TABLE JTAB WHERE pgmid = 'R3TR' AND object = 'SMOD' AND devclass = v_devclass. SELECT SINGLE * FROM TSTCT WHERE sprsl EQ SY-LANGU AND tcode EQ P_TCODE. FORMAT COLOR COL_POSITIVE INTENSIFIED OFF. WRITE:/(19) 'Transaction Code - ', 20(20) P_TCODE, 45(50) TSTCT-ttext. SKIP. IF NOT JTAB[] IS INITIAL. WRITE:/(95) SY-ULINE. FORMAT COLOR COL_HEADING INTENSIFIED ON. WRITE:/1 SY-VLINE, 2 'Exit Name', 21 SY-VLINE , 22 'Description', 95 SY-VLINE. WRITE:/(95) SY-ULINE. LOOP AT JTAB. SELECT SINGLE * FROM MODSAPT WHERE sprsl = SY-LANGU AND name = JTAB-obj_name. FORMAT COLOR COL_NORMAL INTENSIFIED OFF. WRITE:/1 SY-VLINE, 2 JTAB-obj_name HOTSPOT ON, 21 SY-VLINE , 22 MODSAPT-modtext, 95 SY-VLINE. ENDLOOP. WRITE:/(95) SY-ULINE. DESCRIBE TABLE JTAB. SKIP. FORMAT COLOR COL_TOTAL INTENSIFIED ON. WRITE:/ 'No of Exits:' , SY-TFILL. ELSE. FORMAT COLOR COL_NEGATIVE INTENSIFIED ON. WRITE:/(95) 'User Exit doesn’t exist'. ENDIF. ELSE. FORMAT COLOR COL_NEGATIVE INTENSIFIED ON. WRITE:/(95) 'Transaction Code Does Not Exist'. ENDIF. AT LINE-SELECTION. GET CURSOR FIELD field1. CHECK field1(4) EQ 'JTAB'. SET PARAMETER ID 'MON' FIELD sy-lisel+1(10). CALL TRANSACTION 'SMOD' AND SKIP FIRST SCREEN.
While processing, enter the transaction code ‘ME01’ and press F8 (Execute) button. The above code produces the following output −