Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

user exits

Former Member
0 Likes
1,018

hello abapers,

cud u pls gimme detailed info about user exits with realtime examples.pls do send me some links too regarding the documentation .

answers in detail wth relevant examples will b rewarded higher points

1 ACCEPTED SOLUTION
Read only

Former Member
5 REPLIES 5
Read only

p291102
Active Contributor
0 Likes
880

Hi,

From this below coding u can find out how many user exits are availble for any sap transaction codes.

&----


*& Report YMS_USEREXITTEST *

*& *

&----


*& *

*& *

&----


REPORT YMS_USEREXITTEST no standard page heading.

tables : tstc, tadir, modsapt, modact, trdir, tfdir, enlfdir.

tables : tstct.

data : jtab like tadir occurs 0 with header line.

data : field1(30).

data : 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) 'No User Exit exists'.

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.

-End of Program-

Thanks,

Shankar

Read only

Former Member
0 Likes
880

Hi,

hi,

list of user exits in abp:

http://www.planetsap.com/Userexit_List.htm

tutorials:

http://www.sap-img.com/abap/a-short-tutorial-on-user-exits.htm

http://www.sap-img.com/abap/what-is-user-exits.htm

http://www.easymarketplace.de/userexit.php

finding user exits with at-code:

execute the program giving tcode as aprameter:

&----


*& Report Z_USEREXIT_DISPLAY

*&

&----


*&

*&

&----


REPORT Z_USEREXIT_DISPLAY

NO STANDARD PAGE HEADING

LINE-SIZE 200 MESSAGE-ID ZZ.

&----


  • T A B L E D E C L A R A T I O N S *

&----


TABLES: TFTIT,

E071,

E070.

&----


  • S T R U C T U R E D E C L A R A T I O N S *

&----


TYPES: BEGIN OF X_TSTC,

TCODE TYPE TCODE,

PGMNA TYPE PROGRAM_ID,

END OF X_TSTC.

TYPES: BEGIN OF X_TADIR,

OBJ_NAME TYPE SOBJ_NAME,

DEVCLASS TYPE DEVCLASS,

END OF X_TADIR.

TYPES: BEGIN OF X_SLOG,

OBJ_NAME TYPE SOBJ_NAME,

END OF X_SLOG.

TYPES: BEGIN OF X_FINAL,

NAME TYPE SMODNAME,

MEMBER TYPE MODMEMBER,

INCLUDE(15), "Include name

END OF X_FINAL.

&----


  • I N T E R N A L T A B L E D E C L A R A T I O N S *

&----


DATA: IT_TSTC TYPE STANDARD TABLE OF X_TSTC WITH HEADER LINE.

DATA: IT_TADIR TYPE STANDARD TABLE OF X_TADIR WITH HEADER LINE.

DATA: IT_JTAB TYPE STANDARD TABLE OF X_SLOG WITH HEADER LINE.

DATA: IT_FINAL TYPE STANDARD TABLE OF X_FINAL WITH HEADER LINE.

&----


  • V A R I A B L E S D E C L A R A T I O N S *

&----


&----


  • U S E R I N P U T S S C R E E N *

&----


&----


  • S E L E C T I O N S C R E E N *

&----


SELECTION-SCREEN: BEGIN OF BLOCK BLK01 WITH FRAME TITLE TEXT-T01.

PARAMETERS: P_TCODE LIKE TSTC-TCODE OBLIGATORY.

SELECTION-SCREEN END OF BLOCK BLK01.

&----


  • S t a r t o f S e l e c t i o n *

&----


START-OF-SELECTION.

PERFORM GET_TCODES. "Get Tcodes

PERFORM GET_OBJECTS. "Get Objects

&----


  • E n d o f S e l e c t i o n *

&----


END-OF-SELECTION.

PERFORM DISPLAY_RESULTS. "Display Results

&----


*& Form get_tcodes

&----


  • Get Tcodes

----


FORM GET_TCODES.

SELECT TCODE

PGMNA

INTO TABLE IT_TSTC

FROM TSTC

WHERE TCODE = P_TCODE.

IF SY-SUBRC = 0.

SORT IT_TSTC BY TCODE.

ENDIF.

ENDFORM. " get_tcodes

&----


*& Form get_objects

&----


  • Get Objects

----


FORM GET_OBJECTS.

DATA: L_FNAME LIKE RS38L-NAME,

L_GROUP LIKE RS38L-AREA,

L_INCLUDE LIKE RS38L-INCLUDE,

L_NAMESPACE LIKE RS38L-NAMESPACE,

L_STR_AREA LIKE RS38L-STR_AREA.

DATA: V_INCLUDE LIKE RODIOBJ-IOBJNM.

DATA: E_T_INCLUDE TYPE STANDARD TABLE OF ABAPSOURCE WITH HEADER

LINE.

DATA: L_LINE TYPE STRING,

L_TABIX LIKE SY-TABIX.

IF NOT IT_TSTC[] IS INITIAL.

SELECT OBJ_NAME

DEVCLASS

INTO TABLE IT_TADIR

FROM TADIR FOR ALL ENTRIES IN IT_TSTC

WHERE PGMID = 'R3TR' AND

OBJECT = 'PROG' AND

OBJ_NAME = IT_TSTC-PGMNA.

IF SY-SUBRC = 0.

SORT IT_TADIR BY OBJ_NAME DEVCLASS.

SELECT OBJ_NAME

INTO TABLE IT_JTAB

FROM TADIR FOR ALL ENTRIES IN IT_TADIR

WHERE PGMID = 'R3TR' AND

OBJECT = 'SMOD' AND

DEVCLASS = IT_TADIR-DEVCLASS.

IF SY-SUBRC = 0.

SORT IT_JTAB BY OBJ_NAME.

ENDIF.

ENDIF.

ENDIF.

*- Get UserExit names

LOOP AT IT_JTAB.

SELECT NAME

MEMBER

INTO (IT_FINAL-NAME, IT_FINAL-MEMBER)

FROM MODSAP

WHERE NAME = IT_JTAB-OBJ_NAME AND

TYP = 'E'.

APPEND IT_FINAL.

CLEAR IT_FINAL.

ENDSELECT.

ENDLOOP.

*- Process it_final contents.

LOOP AT IT_FINAL.

L_TABIX = SY-TABIX.

CLEAR: L_FNAME,

L_GROUP,

L_INCLUDE,

L_NAMESPACE,

L_STR_AREA.

L_FNAME = IT_FINAL-MEMBER.

CALL FUNCTION 'FUNCTION_EXISTS'

EXPORTING

FUNCNAME = L_FNAME

IMPORTING

GROUP = L_GROUP

INCLUDE = L_INCLUDE

NAMESPACE = L_NAMESPACE

STR_AREA = L_STR_AREA

EXCEPTIONS

FUNCTION_NOT_EXIST = 1

OTHERS = 2.

IF SY-SUBRC = 0.

IF NOT L_INCLUDE IS INITIAL.

*- Get Source code of include.

CLEAR: V_INCLUDE, E_T_INCLUDE, E_T_INCLUDE[].

V_INCLUDE = L_INCLUDE.

CALL FUNCTION 'MU_INCLUDE_GET'

EXPORTING

I_INCLUDE = V_INCLUDE

TABLES

E_T_INCLUDE = E_T_INCLUDE.

IF SY-SUBRC = 0.

LOOP AT E_T_INCLUDE.

IF E_T_INCLUDE-LINE CS 'INCLUDE'.

CLEAR L_LINE.

L_LINE = E_T_INCLUDE-LINE.

CONDENSE L_LINE NO-GAPS.

TRANSLATE L_LINE USING '. '.

L_LINE = L_LINE+7(9).

IT_FINAL-INCLUDE = L_LINE.

MODIFY IT_FINAL INDEX L_TABIX TRANSPORTING INCLUDE.

ENDIF.

ENDLOOP.

ENDIF.

ENDIF.

ENDIF.

ENDLOOP.

ENDFORM. " get_objects

&----


*& Form display_results

&----


  • Display Results

----


FORM DISPLAY_RESULTS.

FORMAT COLOR COL_HEADING.

WRITE:/1(150) SY-ULINE.

WRITE:/ SY-VLINE,

2(23) 'Extension Name',

24 SY-VLINE,

25(39) 'Exit Name',

64 SY-VLINE,

65(74) 'Description',

140 SY-VLINE,

141(9) 'Include',

150 SY-VLINE.

WRITE:/1(150) SY-ULINE.

FORMAT RESET.

SORT IT_FINAL BY NAME MEMBER.

LOOP AT IT_FINAL.

CLEAR TFTIT.

SELECT SINGLE STEXT

INTO TFTIT-STEXT

FROM TFTIT

WHERE SPRAS = 'EN' AND

FUNCNAME = IT_FINAL-MEMBER.

WRITE:/ SY-VLINE,

IT_FINAL-NAME COLOR COL_KEY, 24 SY-VLINE,

25 IT_FINAL-MEMBER, 64 SY-VLINE,

65 TFTIT-STEXT, 140 SY-VLINE,

141 IT_FINAL-INCLUDE, 150 SY-VLINE.

WRITE:/1(150) SY-ULINE.

ENDLOOP.

ENDFORM. " display_results

userexit example:

http://sap.niraj.tripod.com/id21.html

http://www.ficoexpertonline.com/downloads/User%20ExitsWPedit.doc

http://www.allsaplinks.com/

regards,

keerthi

Read only

Former Member
Read only

Former Member
0 Likes
880

Hi Praveen,

Check this matter.

User exits :

1. Introduction

2. How to find user exits

3. Using Project management of SAP Enhancements

1. Introduction:

User exits (Function module exits) are exits developed by SAP. The exit is implementerd as a call to a functionmodule. The code for the function module is writeen by the developer. You are not writing the code directly in the function module, but in the include that is implemented in the function module.

The naming standard of function modules for functionmodule exits is:

EXIT_<program name><3 digit suffix>

The call to a functionmodule exit is implemented as:

CALL CUSTOMER.-FUNCTION ❤️ digit suffix>

Example:

The program for transaction VA01 Create salesorder is SAPMV45A

If you search for CALL CUSTOMER-FUNCTION i program

SAPMV45A you will find ( Among other user exits):

CALL CUSTOMER-FUNCTION '003'

exporting

xvbak = vbak

xvbuk = vbuk

xkomk = tkomk

importing

lvf_subrc = lvf_subrc

tables

xvbfa = xvbfa

xvbap = xvbap

xvbup = xvbup.

The exit calls function module EXIT_SAPMV45A_003

And also check this.

This example code is based on enhancement SUSR0001.This enhancement uses function exit EXIT_SAPLSUSF_001 .

Enhancement : SUSR0001 User Exit after logon to SAP system.

When the User logs in the system, this exit is called each and every time for every user after logon to the R/3 system.

Function Exit : EXIT_SAPLSUSF_001 .

Every dialog user passes through this function module after logon, It can be used to execute individual customer checks and send messages to the user.

TABLE USR02 CONTAINS LOGON DATA and can be used in this exit to get the user logon data and take necessary actions as required by the customer requirement and even LOG_OFF (not recommended by SAP).

STEPS REQUIRED FOR IMPLEMETING THE EXIT

1) Open CMOD(Project maintenance) Transaction. Enter a project name starting with Z. Press enter.

2) Goto Enhancement window by clicking the enhancement button in the application tool bar.

3) Write SUSR0001 in the enhancement column and press enter.

4) Goto Components window (It will show all the exits included in this enhancement), in our case only one Function Exit will be shown.

5) Double click on the Function exit EXIT_SAPLSUSF_001.

The following function source code will be displayed in the function editor

FUNCTION EXIT_SAPLSUSF_001.

*"----


""Lokale Schnittstelle:

*"----


INCLUDE ZXUSRU01.

ENDFUNCTION.

6) Double click on the include ZXUSRU01 .If it will ask to create the include say yes .

7)Write the following code in the include.

DATA W_TEXT(30) TYPE C.

DATA W_DATE(10) TYPE C.

WRITE sy-datum TO W_DATE DD/MM/YYYY.

CONCATENATE ' Date is ' W_DATE INTO W_TEXT.

CALL FUNCTION 'POPUP_TO_INFORM'

EXPORTING

title = 'Welcome to Paradise !'

txt1 = 'Have A Nice Day'

txt2 = W_TEXT

  • TXT3 = ' '

  • TXT4 = ' '

8)Save the include and activate it .Activate the Project also by going to the menu in CMOD transaction. Now The user exit SUSR0001 has been implemented and is ready to use.

9) Logon to the R/3 system . A dialog box will appear with the message

Welcome to Paradise ! with date .

NOTE: BAPIs like BAPI_USER_GET_DETAIL can also be used to get user info or directly read from tables USR02 etc.

Hope this resolves your query.

Reward all the helpful answers.

Regards

Read only

Former Member
0 Likes
880

Praveen,

Here you will have step by step procedure.

http://www.sapbrain.com/TUTORIALS/TECHNICAL/user_exits_tutorial.html

Pls. reward if useful.