ZFIND_ENHANCEMENT(找增强点-新)
Posted Rainystuday
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了ZFIND_ENHANCEMENT(找增强点-新)相关的知识,希望对你有一定的参考价值。
REPORT ZFIND_ENHANCEMENT. *&--------------------------------------------------------------------&* *& 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 2007 &* *&--------------------------------------------------------------------&* *& 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(50) TYPE C , W_CNT(2) TYPE C , W_FUNCNAME LIKE TFDIR-FUNCNAME, W_FSEL LIKE SY-UCOMM, " Determination of screen field W_GRIDTXT(70) TYPE C . "ALV grid title CONSTANTS: C_FMOD(40) TYPE C VALUE \'Function modules searched: \' , C_SUBM(40) TYPE C VALUE \'Submit programs searched: \' , C_DEVC(60) TYPE C VALUE \'User-exits from development classes in function modules\' , C_COL1(12) TYPE C VALUE \'Enhanmt Type\' , C_COL2(40) TYPE C VALUE \'Enhancement\' , C_COL3(30) TYPE C VALUE \'Program/Include\' , C_COL4(20) TYPE C VALUE \'Enhancement Name\' , C_COL5(40) TYPE C VALUE \'Enhancement Description\' , C_COL6(8) TYPE C VALUE \'Project\' , C_COL7(1) TYPE C VALUE \'S\' , C_COL8(12) TYPE C VALUE \'ChangeName\' , C_COL9(10) 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(12) TYPE C, PNAME LIKE TRDIR-NAME, TXT(300), LEVEL TYPE C , MODNAME(30) TYPE C , MODTEXT(60) 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(200), "#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(40) 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 TSTCT WHERE TCODE = P_TCODE AND SPRSL = SY-LANGU. CONCATENATE \'TCode:\' P_TCODE TSTCT-TTEXT INTO W_GRIDTXT SEPARATED BY SPACE. ENDIF . * get program name for ALV grid title IF NOT P_PNAME IS INITIAL . SELECT SINGLE * FROM TRDIRT WHERE NAME = P_PNAME AND SPRSL = SY-LANGU. CONCATENATE \'Program:\' P_PNAME TSTCT-TTEXT INTO W_GRIDTXT SEPARATED BY SPACE. ENDIF . * determine search words KEYWORDS-WORD = \'CALL\' . APPEND KEYWORDS. KEYWORDS-WORD = \'FORM\' . APPEND KEYWORDS. KEYWORDS-WORD = \'PERFORM\' . APPEND KEYWORDS. KEYWORDS-WORD = \'SUBMIT\' . APPEND KEYWORDS. KEYWORDS-WORD = \'INCLUDE\' . APPEND KEYWORDS. KEYWORDS-WORD = \'AUTHORITY-CHECK\' . APPEND KEYWORDS. IF NOT P_TCODE IS INITIAL . * get program name from TCode SELECT SINGLE PGMNA FROM TSTC INTO WA_TSTC-PGMNA WHERE TCODE EQ P_TCODE. IF NOT WA_TSTC-PGMNA IS INITIAL . P_PNAME = WA_TSTC-PGMNA. * TCode does not include program name, but does have reference TCode ELSE . SELECT SINGLE PARAM FROM TSTCP INTO WA_TSTCP-PARAM WHERE TCODE EQ P_TCODE. IF SY-SUBRC = 0 . CHECK WA_TSTCP-PARAM(1) = \'/\' . CHECK WA_TSTCP-PARAM+1(1) = \'*\' . IF WA_TSTCP-PARAM CA \' \' . ENDIF . W_OFF = SY-FDPOS + 1 . SUBTRACT 2 FROM SY-FDPOS. IF SY-FDPOS GT 0 . P_TCODE = WA_TSTCP-PARAM+2(SY-FDPOS). ENDIF . SELECT SINGLE PGMNA FROM TSTC INTO WA_TSTC-PGMNA WHERE TCODE EQ P_TCODE. P_PNAME = WA_TSTC-PGMNA. IF SY-SUBRC <> 0 . MESSAGE S110(/SAPTRX/ASC) WITH \'No program found for: \' P_TCODE. "#EC NOTEXT STOP . ENDIF . ELSE . MESSAGE S110(/SAPTRX/ASC) WITH \'No program found for: \' P_TCODE. "#EC NOTEXT STOP . ENDIF . ENDIF . ENDIF . * Call customer-function aus Program coding READ REPORT P_PNAME INTO SOURCETAB. IF SY-SUBRC > 0 . MESSAGE E017(ENHANCEMENT) WITH P_PNAME RAISING NO_PROGRAM. "#EC * ENDIF . *scan abap-source sourcetab tokens into i_stoken *statements into i_sstmnt *keywords from keywords *overflow into c_overflow *with ANALYSIS. "#EC ********************************** SCAN ABAP-SOURCE SOURCETAB TOKENS INTO I_STOKEN STATEMENTS INTO I_SSTMNT KEYWORDS FROM KEYWORDS OVERFLOW INTO C_OVERFLOW WITH INCLUDES. "#EC ********************************** IF SY-SUBRC > 0 . "keine/syntakt. falsche Ablauflog./Fehler im Skanner MESSAGE E130(ENHANCEMENT) RAISING SYNTAX_ERROR. "#EC ENDIF . * check I_STOKEN for entries CLEAR W_LINNUM. DESCRIBE TABLE I_STOKEN LINES W_LINNUM. IF W_LINNUM GT 0 . W_LEVEL = \'0\' . W_PROG = \'\' . W_INCL = \'\' . PERFORM DATA_SEARCH TABLES I_STOKEN USING W_LEVEL W_PROG W_INCL. ENDIF . ENDFORM . "DATA_SELECT *&--------------------------------------------------------------------&* *& Form GET_FM_DATA # &* *&--------------------------------------------------------------------&* *& &* *&--------------------------------------------------------------------&* FORM GET_FM_DATA. * data selection message to sap gui CALL FUNCTION \'SAPGUI_PROGRESS_INDICATOR\' DESTINATION \'SAPGUI\' KEEPING LOGICAL UNIT OF WORK EXPORTING TEXT = \'Get function module data\' "#EC NOTEXT EXCEPTIONS SYSTEM_FAILURE COMMUNICATION_FAILURE . "#EC * * Function module data SORT I_FMODULE BY NAME. DELETE ADJACENT DUPLICATES FROM I_FMODULE COMPARING NAME. LOOP AT I_FMODULE WHERE DONE NE C_X. CLEAR : I_STOKEN, I_SSTMNT, SOURCETAB, WA_TFDIR, W_INCLUDE . REFRESH : I_STOKEN, I_SSTMNT, SOURCETAB. CLEAR WA_TFDIR. SELECT SINGLE FUNCNAME PNAME INCLUDE FROM TFDIR INTO WA_TFDIR WHERE FUNCNAME = I_FMODULE-NAME. CHECK SY-SUBRC = 0 . CALL FUNCTION \'FUNCTION_INCLUDE_SPLIT\' EXPORTING PROGRAM = WA_TFDIR-PNAME IMPORTING GROUP = W_AREA. CONCATENATE \'L\' W_AREA \'U\' WA_TFDIR-INCLUDE INTO W_INCLUDE. I_FMODULE-PNAME = W_INCLUDE. I_FMODULE-PNAME2 = WA_TFDIR-PNAME. MODIFY I_FMODULE. READ REPORT I_FMODULE-PNAME INTO SOURCETAB. IF SY-SUBRC = 0 . SCAN ABAP-SOURCE SOURCETAB TOKENS INTO I_STOKEN STATEMENTS INTO I_SSTMNT KEYWORDS FROM KEYWORDS WITH INCLUDES. IF SY-SUBRC > 0 . MESSAGE E130(ENHANCEMENT) RAISING SYNTAX_ERROR. ENDIF . * check i_stoken for entries CLEAR W_LINNUM. DESCRIBE TABLE I_STOKEN LINES W_LINNUM. IF W_LINNUM GT 0 . W_LEVEL = \'1\' . W_PROG = I_FMODULE-PNAME2. W_INCL = I_FMODULE-PNAME. PERFORM DATA_SEARCH TABLES I_STOKEN USING W_LEVEL W_PROG W_INCL. ENDIF . ENDIF . ENDLOOP . * store development classes IF P_DEVC = C_X. LOOP AT I_FMODULE. CLEAR : WA_TADIR, WA_ENLFDIR. SELECT SINGLE AREA FROM ENLFDIR INTO WA_ENLFDIR-AREA WHERE FUNCNAME = I_FMODULE-NAME. CHECK NOT WA_ENLFDIR-AREA IS INITIAL . SELECT SINGLE DEVCLASS INTO WA_TADIR-DEVCLASS FROM TADIR WHERE PGMID = \'R3TR\' AND OBJECT = \'FUGR\' AND OBJ_NAME = WA_ENLFDIR-AREA. CHECK NOT WA_TADIR-DEVCLASS IS INITIAL . MOVE WA_TADIR-DEVCLASS TO I_DEVCLASS-CLAS. APPEND I_DEVCLASS. I_FMODULE-DONE = C_X. MODIFY I_FMODULE. ENDLOOP . SORT I_DEVCLASS. DELETE ADJACENT DUPLICATES FROM I_DEVCLASS. ENDIF . ENDFORM . "GET_FM_DATA *&--------------------------------------------------------------------&* *& Form GET_SUBMIT_DATA &* *&--------------------------------------------------------------------&* *& &* *&--------------------------------------------------------------------&* FORM GET_SUBMIT_DATA. * data selection message to sap gui CALL FUNCTION \'SAPGUI_PROGRESS_INDICATOR\' DESTINATION \'SAPGUI\' KEEPING LOGICAL UNIT OF WORK EXPORTING TEXT = \'Get submit data\' "#EC NOTEXT EXCEPTIONS SYSTEM_FAILURE COMMUNICATION_FAILURE . "#EC * SORT I_SUBMIT. DELETE ADJACENT DUPLICATES FROM I_SUBMIT COMPARING PNAME. W_LEVEL = \'0\' . LOOP AT I_SUBMIT WHERE DONE NE C_X. CLEAR : I_STOKEN, I_SSTMNT, SOURCETAB. REFRESH : I_STOKEN, I_SSTMNT, SOURCETAB. READ REPORT I_SUBMIT-PNAME INTO SOURCETAB. IF SY-SUBRC = 0 . SCAN ABAP-SOURCE SOURCETAB TOKENS INTO I_STOKEN STATEMENTS INTO I_SSTMNT KEYWORDS FROM KEYWORDS WITH INCLUDES. IF SY-SUBRC > 0 . * message e130(enhancement) raising syntax_error. CONTINUE . ENDIF . * check i_stoken for entries CLEAR W_LINNUM. DESCRIBE TABLE I_STOKEN LINES W_LINNUM. IF W_LINNUM GT 0 . W_PROG = I_SUBMIT-PNAME. W_INCL = \'\' . PERFORM DATA_SEARCH TABLES I_STOKEN USING W_LEVEL W_PROG W_INCL. ENDIF . ENDIF . * restrict number of submit program selected for processing DESCRIBE TABLE I_SUBMIT LINES W_LINNUM. IF W_LINNUM GE P_LIMIT. W_LEVEL = \'1\' . ENDIF . I_SUBMIT-DONE = C_X. MODIFY I_SUBMIT. ENDLOOP . ENDFORM . "GET_SUBMIT_DATA *&--------------------------------------------------------------------&* *& Form DATA_SEARCH &* *&--------------------------------------------------------------------&* *& &* *&--------------------------------------------------------------------&* FORM DATA_SEARCH TABLES P_STOKEN STRUCTURE STOKEN USING P_LEVEL L_PROG L_INCL. LOOP AT P_STOKEN. CLEAR I_USEREXIT. * Workflow IF P_WFLOW = C_X. IF P_LEVEL EQ \'1\' . " do not perform for function modules (2nd pass) IF P_STOKEN-STR+1(16) CS \'SWE_EVENT_CREATE\' . REPLACE ALL OCCURRENCES OF \'\'\'\' IN P_STOKEN-STR WITH \'\' . I_USEREXIT-TYPE = \'WorkFlow\' . I_USEREXIT-TXT = P_STOKEN-STR. CONCATENATE L_PROG \'/\' L_INCL INTO I_USEREXIT-PNAME. APPEND I_USEREXIT. ENDIF . ENDIF . ENDIF . TABIX = SY-TABIX + 1 . I_USEREXIT-LEVEL = P_LEVEL. IF I_USEREXIT-LEVEL = \'0\' . IF L_INCL IS INITIAL . I_USEREXIT-PNAME = P_PNAME. ELSE . CONCATENATE P_PNAME \'-\' L_INCL INTO I_USEREXIT-PNAME. ENDIF . ELSE . IF L_INCL IS INITIAL . I_USEREXIT-PNAME = L_PROG. ELSE . CONCATENATE L_PROG \'-\' L_INCL INTO I_USEREXIT-PNAME. ENDIF . ENDIF . * AUTHORITY-CHECKS IF P_AUTH = C_X. IF P_STOKEN-STR EQ \'AUTHORITY-CHECK\' . CHECK P_LEVEL EQ \'0\' . " do not perform for function modules (2nd pass) W_INDEX = SY-TABIX + 2 . READ TABLE P_STOKEN INDEX W_INDEX INTO WA_STOKEN. CHECK NOT WA_STOKEN-STR CS \'STRUCTURE\' . CHECK NOT WA_STOKEN-STR CS \'SYMBOL\' . READ TABLE I_SUBMIT WITH KEY PNAME = WA_STOKEN-STR. IF SY-SUBRC <> 0 . I_USEREXIT-PNAME = I_SUBMIT-PNAME. I_USEREXIT-TYPE = \'AuthCheck\' . I_USEREXIT-TXT = WA_STOKEN-STR. REPLACE ALL OCCURRENCES OF \'\'\'\' IN I_USEREXIT-TXT WITH SPACE. CLEAR TOBJT. SELECT SINGLE * FROM TOBJT WHERE OBJECT = I_USEREXIT-TXT AND LANGU = SY-LANGU. I_USEREXIT-MODNAME = \'AUTHORITY-CHECK\' . I_USEREXIT-MODTEXT = TOBJT-TTEXT. APPEND I_USEREXIT. ENDIF . ENDIF . ENDIF . * Text searches IF NOT P_TEXT IS INITIAL . IF P_STOKEN-STR CS P_TEXT. I_USEREXIT-PNAME = I_SUBMIT-PNAME. I_USEREXIT-TYPE = \'TextSearch\' . I_USEREXIT-TXT = WA_STOKEN-STR. I_USEREXIT-MODNAME = \'Text Search\' . I_USEREXIT-MODTEXT = P_STOKEN-STR. APPEND I_USEREXIT. ENDIF . ENDIF . * Include (SE38) IF P_STOKEN-STR EQ \'INCLUDE\' . CHECK P_LEVEL EQ \'0\' . " do not perform for function modules (2nd pass) W_INDEX = SY-TABIX + 1 . READ TABLE P_STOKEN INDEX W_INDEX INTO WA_STOKEN. CHECK NOT WA_STOKEN-STR CS \'STRUCTURE\' . CHECK NOT WA_STOKEN-STR CS \'SYMBOL\' . READ TABLE I_SUBMIT WITH KEY PNAME = WA_STOKEN-STR. IF SY-SUBRC <> 0 . I_SUBMIT-PNAME = WA_STOKEN-STR. I_SUBMIT-LEVEL = P_LEVEL. APPEND I_SUBMIT. ENDIF . ENDIF . * Enhancements (SMOD) IF P_EXIT = C_X. IF P_STOKEN-STR EQ \'CUSTOMER-FUNCTION\' . CLEAR W_FUNCNAME. READ TABLE P_STOKEN INDEX TABIX. TRANSLATE P_STOKEN-STR USING \'\'\' \' . CONDENSE P_STOKEN-STR. IF L_PROG IS INITIAL . CONCATENATE \'EXIT\' P_PNAME P_STOKEN-STR INTO W_FUNCNAME SEPARATED BY \'_\' . ELSE . CONCATENATE \'EXIT\' L_PROG P_STOKEN-STR INTO W_FUNCNAME SEPARATED BY \'_\' . ENDIF . SELECT SINGLE MEMBER FROM MODSAP INTO WA_MODSAP-MEMBER WHERE MEMBER = W_FUNCNAME. IF SY-SUBRC = 0 . " check for valid enhancement I_USEREXIT-TYPE = \'Enhancement\' . I_USEREXIT-TXT = W_FUNCNAME. APPEND I_USEREXIT. ELSE . CLEAR WA_D010INC. SELECT SINGLE MASTER INTO WA_D010INC-MASTER FROM D010INC WHERE INCLUDE = L_PROG. CONCATENATE \'EXIT\' WA_D010INC-MASTER P_STOKEN-STR INTO W_FUNCNAME SEPARATED BY \'_\' . I_USEREXIT-TYPE = \'Enhancement\' . I_USEREXIT-TXT = W_FUNCNAME. ENDIF . ENDIF . ENDIF . * BADIs (SE18) IF P_BADI = C_X. IF P_STOKEN-STR CS \'cl_exithandler=\' . W_INDEX = SY-TABIX + 4 . READ TABLE P_STOKEN INDEX W_INDEX INTO WA_STOKEN. I_USEREXIT-TXT = WA_STOKEN-STR. REPLACE ALL OCCURRENCES OF \'\'\'\' IN I_USEREXIT-TXT WITH SPACE. I_USEREXIT-TYPE = \'BADI\' . CLEAR SXS_ATTR. " ensure a real BADI SELECT SINGLE * FROM SXS_ATTR WHERE EXIT_NAME = I_USEREXIT-TXT. IF SY-SUBRC = 0 . APPEND I_USEREXIT. ENDIF . ENDIF . ENDIF . * Business transaction events (FIBF) IF P_BTE = C_X. IF P_STOKEN-STR CS \'OPEN_FI_PERFORM\' . I_USEREXIT-TYPE = \'BusTrEvent\' . I_USEREXIT-TXT = P_STOKEN-STR. REPLACE ALL OCCURRENCES OF \'\'\'\' IN I_USEREXIT-TXT WITH SPACE. I_USEREXIT-MODNAME = I_USEREXIT-TXT+16(8). CASE I_USEREXIT-TXT+25(1). WHEN \'E\' . CLEAR WA_TBE01T. SELECT SINGLE TEXT1 INTO WA_TBE01T-TEXT1 FROM TBE01T WHERE EVENT = I_USEREXIT-TXT+16(8) AND SPRAS = SY-LANGU. IF WA_TBE01T-TEXT1 IS INITIAL . I_USEREXIT-MODTEXT = \'<Not active>\' . "#EC NOTEXT ELSE . I_USEREXIT-MODTEXT = WA_TBE01T-TEXT1. ENDIF . I_USEREXIT-MODNAME+8 = \'/P&S\' . "#EC NOTEXT WHEN \'P\' . CLEAR WA_TPS01T. SELECT SINGLE TEXT1 INTO WA_TPS01T-TEXT1 FROM TPS01T WHERE PROCS = I_USEREXIT-TXT+16(8) AND SPRAS = SY-LANGU. I_USEREXIT-MODTEXT = WA_TPS01T-TEXT1. I_USEREXIT-MODNAME+8 = \'/Process\' . ENDCASE . APPEND I_USEREXIT. ENDIF . ENDIF . * Program exits (SE38) IF P_PROG = C_X. IF P_STOKEN-STR CS \'USEREXIT_\' . CHECK NOT P_STOKEN-STR CS \'-\' . " ensure not USEREXIT_XX-XXX CHECK NOT P_STOKEN-STR CS \'(\' . " ensure not SUBMIT_XX(X) I_USEREXIT-TYPE = \'Program Exit\' . I_USEREXIT-TXT = P_STOKEN-STR. REPLACE ALL OCCURRENCES OF \'\'\'\' IN I_USEREXIT-TXT WITH SPACE. APPEND I_USEREXIT. ENDIF . ENDIF . * Submit programs (SE38) IF P_STOKEN-STR CS \'SUBMIT\' . CHECK P_LEVEL EQ \'0\' . " do not perform for function modules (2nd pass) CHECK NOT P_STOKEN-STR CS \'_\' . " ensure not SUBMIT_XXX W_INDEX = SY-TABIX + 1 . READ TABLE P_STOKEN INDEX W_INDEX INTO WA_STOKEN. CHECK NOT WA_STOKEN-STR CS \'_\' . " ensure not SUBMIT_XXX REPLACE ALL OCCURRENCES OF \'\'\'\' IN WA_STOKEN-STR WITH SPACE. READ TABLE I_SUBMIT WITH KEY PNAME = WA_STOKEN-STR. IF SY-SUBRC <> 0 . I_SUBMIT-PNAME = WA_STOKEN-STR. I_SUBMIT-LEVEL = P_LEVEL. APPEND I_SUBMIT. ENDIF . ENDIF . * Perform routines (which reference external programs) IF P_STOKEN-STR CS \'PERFORM\' . CHECK P_LEVEL EQ \'0\' . " do not perform for function modules (2nd pass) W_INDEX = SY-TABIX + 1 . READ TABLE P_STOKEN INDEX W_INDEX INTO WA_STOKEN. IF NOT WA_STOKEN-OVFL IS INITIAL . W_OFF = WA_STOKEN-OFF1 + 10 . W_STR = C_OVERFLOW+W_OFF(30). FIND \')\' IN W_STR MATCH OFFSET W_OFF. IF SY-SUBRC = 0 . W_OFF = W_OFF + 1 . WA_STOKEN-STR = W_STR(W_OFF). ENDIF . ENDIF . CHECK WA_STOKEN-STR CS \'(\' . W_OFF = 0 . WHILE SY-SUBRC = 0 . IF WA_STOKEN-STR+W_OFF(1) EQ \'(\' . REPLACE SECTION OFFSET W_OFF LENGTH 1 OF WA_STOKEN-STR WITH \'\' . REPLACE ALL OCCURRENCES OF \')\' IN WA_STOKEN-STR WITH SPACE. READ TABLE I_SUBMIT WITH KEY PNAME = WA_STOKEN-STR. IF SY-SUBRC <> 0 . I_SUBMIT-PNAME = WA_STOKEN-STR. APPEND I_SUBMIT. ENDIF . EXIT . ELSE . REPLACE SECTION OFFSET W_OFF LENGTH 1 OF WA_STOKEN-STR WITH \'\' . SHIFT WA_STOKEN-STR LEFT DELETING LEADING SPACE. ENDIF . ENDWHILE . ENDIF . * Function modules (SE37) IF P_STOKEN-STR CS \'FUNCTION\' . CLEAR I_FMODULE. IF P_LEVEL EQ \'0\' . " do not perform for function modules (2nd pass) W_INDEX = SY-TABIX + 1 .以上是关于ZFIND_ENHANCEMENT(找增强点-新)的主要内容,如果未能解决你的问题,请参考以下文章