0% found this document useful (0 votes)
40 views5 pages

46 - Sap Abap - User Exits

User exits in SAP ABAP are utilized when standard extractors do not meet specific data or functionality needs, particularly in Sales and Distribution (SD) modules. They allow for modifications to SAP standard programs and can be accessed through the IMG path for detailed documentation. Several user exits are outlined, including USEREXIT_FIELD_MODIFICATION and USEREXIT_SAVE_DOCUMENT, each serving distinct purposes in enhancing the functionality of sales processes.

Uploaded by

akhter
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
40 views5 pages

46 - Sap Abap - User Exits

User exits in SAP ABAP are utilized when standard extractors do not meet specific data or functionality needs, particularly in Sales and Distribution (SD) modules. They allow for modifications to SAP standard programs and can be accessed through the IMG path for detailed documentation. Several user exits are outlined, including USEREXIT_FIELD_MODIFICATION and USEREXIT_SAVE_DOCUMENT, each serving distinct purposes in enhancing the functionality of sales processes.

Uploaded by

akhter
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 5

Page 1 of 5

SAP ABAP - User Exits


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

USEREXIT_FIELD_MODIFICATION
1
Used to modify screen attributes.

USEREXIT_SAVE_DOCUMENT
2
Helps in performing operations when the user hits Save.

USEREXIT_SAVE_DOCUMENT_PREPARE
3 Very useful to check input fields, put any value in the field or show a popup to
users and to confirm the document.

USEREXIT_MOVE_FIELD_TO_VBAK
4
Used when user header changes are moved to header work area.

USEREXIT_MOVE_FIELD_TO_VBAP
5
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.

Example

REPORT ZUSEREXIT1.
TABLES:
TSTC, TSTCT,

https://www.tutorialspoint.com/sap_abap/sap_abap_user_exits.htm 1/5
Page 2 of 5

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.

https://www.tutorialspoint.com/sap_abap/sap_abap_user_exits.htm 2/5
Page 3 of 5

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.

https://www.tutorialspoint.com/sap_abap/sap_abap_user_exits.htm 3/5
Page 4 of 5

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 −

https://www.tutorialspoint.com/sap_abap/sap_abap_user_exits.htm 4/5
Page 5 of 5

https://www.tutorialspoint.com/sap_abap/sap_abap_user_exits.htm 5/5

You might also like