Article transferred from http://blog.csdn.net/lyb_yt/article/details/6866957
*&--------------------------------------------------------------------&*
*& report:z_userexit (V9) &*
*& Pja Consultancy Services (www.pjas.com) &*
*&--------------------------------------------------------------------&*
*& This report attmpts to find enhancements, program-exits, Badis &*
*& and Business Transaction Events in a particular program/tcode. &*
*& last updated:09, may &*
*&--------------------------------------------------------------------&*
*& Selection Texts:
*& P_ALV ALV Format
*& P_auth Include Authority-check Search
*& P_badi Display Badis
*& p_bte Display Business Trans Events
*& P_DEVC Show Development class exits
*& p_exit Display User exits
*& p_func Show function modules
*& p_limit LIMIT No. of submits to search
*& P_LST Standard list format
*& P_pname Program Name
*& P_prog Display Program exits
*& P_SUBM Show submits
*& P_tcode Transaction Code
*& P_text Search for TEXT
*& P_wflow Display Workflow Links
*&--------------------------------------------------------------------&*
*& Text Symbols:
*& M01 Enter Tcode or program
*& M02 Enter At least one scope criteria
*& S01 Selection data (Tcode takes precedence over program name)
*& S02 Scope Criteria
*& S03 Display Criteria
*&--------------------------------------------------------------------&*
Report Z_userexit
No standard page heading
Line-size 201.
Tables:sxs_attr,
TOBJT,
TSTCT, "Tcode texts
Trdirt, "program texts
Sxc_exit. "BADI exits
Type-pools:slis. "Globale Typen fьr generische listbausteine
Data:tabix like Sy-tabix,
W_linnum Type I,
W_off Type I,
W_index like Sy-tabix,
W_include like Trdir-name,
W_prog like Trdir-name,
W_incl like Trdir-name,
W_area like Rs38l-area,
W_level,
W_STR (+) Type C,
W_CNT (2) Type C,
W_funcname like Tfdir-funcname,
W_fsel like Sy-ucomm, "determination of the screen field
W_gridtxt (+) Type C. "ALV Grid title
Constants:c_fmod (+) Type C value ' Function modules searched: ',
C_SUBM (+) Type C value ' Submit programs searched: ',
C_DEVC Type C value ' user-exits from development classes in function modules ',
C_col1 (+) Type C value ' ENHANMT type ',
C_col2 (+) Type C value ' enhancement ',
C_col3 (+) Type C value ' Program/include ',
C_COL4 (+) Type C value ' enhancement Name ',
C_COL5 (+) Type C value ' enhancement Description ',
C_COL6 (8) Type C value ' Project ',
C_COL7 (1) Type C value ' S ',
C_col8 (+) Type C value ' ChangeName ',
C_COL9 (Ten) Type C value ' ChangeDate ',
C_x Type C value ' x '.
* Work AREAS:ABAP Workbench
Data:begin of Wa_d010inc.
Data:master type D010inc-master.
Data:end of Wa_d010inc.
Data:begin of Wa_tfdir.
Data:funcname type Tfdir-funcname,
PName type Tfdir-pname,
Include type Tfdir-include.
Data:end of Wa_tfdir.
Data:begin of Wa_tadir.
Data:devclass type Tadir-devclass.
Data:end of Wa_tadir.
Data:begin of WA_TSTC.
Data:pgmna type Tstc-pgmna.
Data:end of WA_TSTC.
Data:begin of Wa_tstcp.
Data:param type Tstcp-param.
Data:end of Wa_tstcp.
Data:begin of Wa_enlfdir.
Data:area type Enlfdir-area.
Data:end of Wa_enlfdir.
* Work Areas:badis
Data:begin of Wa_sxs_attr.
Data:exit_name type Sxs_attr-exit_name.
Data:end of Wa_sxs_attr.
Data:begin of WA_SXS_ATTRT.
Data:text type Sxs_attrt-text.
Data:end of WA_SXS_ATTRT.
* Work areas:enhancements
Data:begin of Wa_modsap.
Data:member type Modsap-member.
Data:end of Wa_modsap.
Data:begin of Wa_modsapa.
Data:name type Modsapa-name.
Data:end of Wa_modsapa.
Data:begin of Wa_modsapt.
Data:modtext type Modsapt-modtext.
Data:end of Wa_modsapt.
* Work areas:business Transaction Events
Data:begin of WA_TBE01T.
DATA:TEXT1 type Tbe01t-text1.
Data:end of WA_TBE01T.
Data:begin of WA_TPS01T.
DATA:TEXT1 type Tps01t-text1.
Data:end of WA_TPS01T.
* User-exits
Types:begin of Ty_mod,
Member like Modact-member,
Name like Modact-name,
Status Like Modattr-status,
Anam like Modattr-anam,
Adat like Modattr-adat,
End of Ty_mod.
Data:w_mod type Ty_mod.
Types:begin of T_userexit,
Type (a) Type C,
PName like Trdir-name,
TXT (300),
Level Type C,
ModName (+) Type C,
Modtext (+) Type C,
Modattr type Ty_mod,
Colour (4) Type C,
End of T_userexit.
Data:i_userexit type standard table of T_userexit with header line.
* Function Module Developmnet classes
Types:begin of T_devclass,
Clas like Trdir-clas,
End of T_devclass.
Data:i_devclass type standard table of T_devclass with header line.
* Submit Programs
Types:begin of T_submit,
PName like Trdir-name,
Level
Done
End of T_submit.
Data:i_submit type standard table of T_submit with header line.
* Source Code
Types:begin of T_sourcetab, "#EC * (Slin lьgt!)
Line (+), "#EC * (Slin lьgt!)
End of T_sourcetab. "#EC * (Slin lьgt!)
Data:sourcetab type standard table of T_sourcetab with header line.
Data C_overflow (30000) Type C.
* Description of an ABAP/4 source analysis token
*data:i_stoken type standard table of Stokex with header line.
Data:i_stoken type standard table of Stoken with header line.
Data wa_stoken like I_stoken.
* Description of an ABAP/4 source analysis statement
DATA:I_SSTMNT type standard table of Sstmnt with header line. " #EC NEEDED
* Keywords for searching ABAP code
Types:begin of T_keywords,
Word (30),
End of T_keywords.
Data:keywords type standard table of T_keywords with header line.
* Function Modules within program
Types:begin of T_fmodule,
Name like Rs38l-name,
PName like Trdir-name,
Pname2 like Trdir-name,
Level
Bapi
Done
End of T_fmodule.
Data:i_fmodule type standard table of T_fmodule with header line.
* ALV Definitions
Data i_fieldcat type Slis_t_fieldcat_alv with header line.
Data i_layout type Slis_layout_alv.
Data i_sort type Slis_t_sortinfo_alv with header line.
*&--------------------------------------------------------------------&*
*& Selection Options &*
*&--------------------------------------------------------------------&*
Selection-screen begin of block SELSCR1 with frame title text-s01.
Parameter:p_pname like Trdir-name,
P_tcode like Syst-tcode,
P_limit (4) type N default 500.
Selection-screen Skip.
Selection-screen end of Block SELSCR1.
Selection-screen begin of block SELSCR2 with frame title TEXT-S02.
Parameter:p_badi as checkbox default C_x,
P_bte as checkbox default C_x,
P_exit as checkbox default C_x,
P_prog as checkbox default C_x,
P_wflow as CheckBox,
P_auth as checkbox.
Selection-screen Skip.
Parameter:p_text (+) Type C.
Selection-screen end of Block Selscr2.
Selection-screen begin of block SELSCR3 with frame title text-s03.
PARAMETER:P_ALV RadioButton Group rad1 Default ' X ',
P_lst RadioButton Group Rad1.
Selection-screen Skip.
PARAMETER:P_DEVC like rihea-dy_ofn default ' modif ID A01,
P_func like rihea-dy_ofn default ' modif ID A01,
P_SUBM like rihea-dy_ofn default ' modif ID a01.
Selection-screen end of Block SELSCR3.
*&--------------------------------------------------------------------&*
*& start-of-selection &*
*&--------------------------------------------------------------------&*
Start-of-selection.
If P_pname is initial and P_tcode is initial.
Message i000 (G01) with TEXT-M01.
Stop.
endif.
If P_badi is initial and
P_exit is initial and
P_bte is initial and
P_wflow is initial and
P_auth is initial and
P_prog is initial.
Message i000 (G01) with TEXT-M02.
Stop.
endif.
* Ensure P_limit is not zero.
If P_limit = 0.
P_limit = 1.
endif.
Perform data_select.
Perform get_submit_data.
Perform get_fm_data.
Perform get_additional_data.
Perform data_display.
*&--------------------------------------------------------------------&*
*& Form Data_select &*
*&--------------------------------------------------------------------&*
*& &*
*&--------------------------------------------------------------------&*
Form Data_select.
* Data selection message to SAP GUI
Call function ' Sapgui_progress_indicator '
Destination ' SAPgui '
Keeping logical unit of work
Exporting
Text = ' Get programs/includes ' "#EC notext
EXCEPTIONS
System_failure
Communication_failure
. "#EC *
* Get Tcode name for ALV grid title
Clear W_gridtxt.
If not P_tcode is initial.
Select Single * from</