*&---------------------------------------------------------------------*
*& Report ZPZTEST
*&
*&---------------------------------------------------------------------*
*& find_userexit_and_badi
*&
*&---------------------------------------------------------------------*
REPORT zfind NO STANDARD PAGE HEADING.
*&---------------------------------------------------------------------*
*& Enter the transaction code that you want to search through in order
*& to find which Standard SAP User Exits and BADIs
*&
*&---------------------------------------------------------------------*
*& For field 'SUBC' of table 'TRDIR':
*& M Module Pool
*& F Function group
*& S Subroutine Pool
*& J Interface pool
*& K Class pool
*& T Type Pool
*& X XSLT Program
*&---------------------------------------------------------------------*
*& Tables
*&---------------------------------------------------------------------*
TABLES: tstc , " SAP Transaction Codes
tadir , " Directory of Repository Objects
modsapt , " SAP Enhancements - Short Texts
sxs_attrt, " SAP BADI - short text
modact , " Modifications
trdir , " System table TRDIR
tfdir , " Function Module
enlfdir , " Additional Attributes for Function Modules
tstct . " Transaction Code Texts
*&---------------------------------------------------------------------*
*& Variables
*&---------------------------------------------------------------------*
DATA: jtab LIKE tadir OCCURS 0 WITH HEADER LINE.
DATA: field1(30).
DATA: v_devclass LIKE tadir-devclass.
DATA: object LIKE tadir-object.
DATA: bdcdata_wa TYPE bdcdata,
bdcdata_tab TYPE TABLE OF bdcdata.
DATA: opt TYPE ctu_params.
*&---------------------------------------------------------------------*
*& Selection Screen Parameters
*&---------------------------------------------------------------------*
SELECTION-SCREEN BEGIN OF BLOCK a01 WITH FRAME TITLE text-001.
*SELECTION-SCREEN SKIP.
PARAMETERS: p_tcode LIKE tstc-tcode OBLIGATORY.
*SELECTION-SCREEN SKIP.
PARAMETERS: exit RADIOBUTTON GROUP 1 DEFAULT 'X',
badi RADIOBUTTON GROUP 1.
SELECTION-SCREEN END OF BLOCK a01.
DEFINE bdc_program.
clear bdcdata_wa.
bdcdata_wa-program = &1.
bdcdata_wa-dynpro = &2.
bdcdata_wa-dynbegin = &3.
append bdcdata_wa to bdcdata_tab.
END-OF-DEFINITION.
DEFINE bdc_detail.
clear bdcdata_wa.
bdcdata_wa-fnam = &1.
bdcdata_wa-fval = &2.
append bdcdata_wa to bdcdata_tab.
END-OF-DEFINITION.
*&---------------------------------------------------------------------*
*& Start of main program
*&---------------------------------------------------------------------*
START-OF-SELECTION.
IF exit = 'X'.
object = 'SMOD'. " User-exit!
ELSE.
object = 'SXSD'. " BADI!
ENDIF.
* Validate Transaction Code:
SELECT SINGLE * FROM tstc WHERE tcode EQ p_tcode.
* Find Repository Objects for transaction code:
IF sy-subrc EQ 0. " IF 1
SELECT SINGLE * FROM tadir WHERE pgmid = 'R3TR'
AND object = 'PROG'
AND obj_name = tstc-pgmna. " Program name!
MOVE: tadir-devclass TO v_devclass. " Package
IF sy-subrc NE 0.
SELECT SINGLE * FROM trdir WHERE name = tstc-pgmna.
IF trdir-subc EQ 'F'. " Function Group
SELECT SINGLE * FROM tfdir WHERE pname = tstc-pgmna.
SELECT