Author: Thomas Schulz
Submitted: April 2, 2007
This report can be used to search for strings in ABAP source code includes.
Error rendering macro 'code': Invalid value specified for parameter 'com.atlassian.confluence.ext.code.render.InvalidValueException'REPORT Z_FIND line-size 300 NO STANDARD PAGE HEADING. "#EC * tables: trdir. types: begin of SSrcTab, Line(256) type c, end of SSrcTab, begin of SDynPro, Prog like d020S-Prog, DNum like d020S-DNum, end of SDynPro. parameters: Find_Str(256) type c default '*test*'. "#EC * select-options: Includes for trdir-name default 'Z*' option CP sign I. "#EC * data: gs_DynHeader type d020s, "#EC NEEDED gt_DynFields type table of d021s, "#EC NEEDED gt_DynLines type table of d022s, gt_DynParams type table of d023s, "#EC NEEDED gs_DynPro type SDynPro, gv_Exit type boolean, gt_SrcCode type SSrcTab occurs 0 with header line, gv_SrcLine(8) type c, gv_RepName like trdir-name, gt_RepName type table of ProgName, gv_DynNum type sydynnr, gv_DbCount type i, gv_NumLines type i, gv_NumLines2 type i, gv_NumFiles type i, gv_NumDynPros type i, gv_NumFiles2 type i, gv_NumBytes type p, gv_SomethingFound type c, gv_DisplayOnly type c, gv_LineNum type i, gv_ScrollPos type i, gv_Index type i, gv_NumNames type i, gv_Mod type i, gv_Progress type i. AUTHORITY-CHECK OBJECT 'S_DEVELOP' ID 'DEVCLASS' FIELD '* ' ID 'OBJTYPE' FIELD 'PROG ' ID 'OBJNAME' FIELD '* ' ID 'P_GROUP' FIELD '* ' ID 'ACTVT' FIELD '03 '. if sy-subrc <> 0. exit. endif. AUTHORITY-CHECK OBJECT 'S_DEVELOP' ID 'DEVCLASS' FIELD '* ' ID 'OBJTYPE' FIELD 'XSLT ' ID 'OBJNAME' FIELD '* ' ID 'P_GROUP' FIELD '* ' ID 'ACTVT' FIELD '03 '. if sy-subrc <> 0. exit. endif. if Find_Str is initial. Find_Str = 'never find this'. endif. select count(*) from trdir where Name in Includes. gv_NumNames = sy-dbcnt. select count(*) from d020s where Prog in Includes. gv_NumNames = gv_NumNames + sy-dbcnt. select Name from trdir into gv_RepName where Name in Includes. append gv_RepName to gt_RepName. endselect. sort gt_RepName. loop at gt_RepName into gv_RepName. if not gv_Exit is initial. exit. endif. perform FindIt. endloop. select Prog DNum from d020s into (gv_RepName, gv_DynNum) where Prog in Includes. if not gv_Exit is initial. exit. endif. perform FindIt. endselect. write: / gv_NumFiles2, ' includes found = ', gv_NumLines2, ' lines'. write: / gv_NumFiles , ' includes read = ', gv_NumLines , ' lines', gv_NumBytes , ' characters'. write: / gv_NumDynPros, ' screen flow logics read'. write: /. form FindIt. gv_DbCount = gv_DbCount + 1. if not gv_RepName is initial. if gv_NumNames > 100. gv_Mod = gv_DbCount mod ( gv_NumNames / 100 ). if gv_Mod = 0. gv_Progress = gv_Progress + 1. CALL FUNCTION 'SAPGUI_PROGRESS_INDICATOR' EXPORTING PERCENTAGE = gv_Progress. endif. endif. perform Find. endif. endform. form Find. data: lv_FirstTime type c, lv_RepAndDynNum type char64. if gv_DynNum is initial. read report gv_RepName into gt_SrcCode. if sy-subrc <> 0. break-point. "#EC NOBREAK endif. else. gs_DynPro-Prog = gv_RepName. gs_DynPro-DNum = gv_DynNum. import dynpro gs_DynHeader gt_DynFields gt_DynLines gt_DynParams id gs_DynPro. if sy-subrc <> 0. break-point. "#EC NOBREAK endif. gt_SrcCode[] = gt_DynLines[]. endif. loop at gt_SrcCode where line cp Find_Str. gv_Index = sy-tabix. if lv_FirstTime is initial. if not gv_DynNum is initial. concatenate gv_RepName gv_DynNum into lv_RepAndDynNum separated by space. write: / lv_RepAndDynNum. else. write: / gv_RepName. endif. hide gv_RepName. hide gv_DynNum. clear gv_DisplayOnly. hide gv_DisplayOnly. lv_FirstTime = 'X'. gv_SomethingFound = 'X'. gv_NumFiles2 = gv_NumFiles2 + 1. endif. gv_SrcLine = gv_Index. if gt_SrcCode-line(1) = '*'. write: / gv_SrcLine intensified off, gt_SrcCode-line color col_negative inverse on intensified off. else. write: / gv_SrcLine intensified off, gt_SrcCode-line intensified off. endif. hide gv_RepName. hide gv_DynNum. gv_DisplayOnly = 'X'. hide gv_DisplayOnly. gv_LineNum = gv_Index. hide gv_LineNum. gv_NumLines2 = gv_NumLines2 + 1. endloop. if not lv_FirstTime is initial. write sy-uline(128). endif. loop at gt_SrcCode. gv_NumLines = gv_NumLines + 1. gv_NumBytes = gv_NumBytes + strlen( gt_SrcCode-line ). endloop. gv_NumFiles = gv_NumFiles + 1. if not gv_DynNum is initial. gv_NumDynPros = gv_NumDynPros + 1. endif. endform. at line-selection. if not gv_RepName is initial. if gv_DisplayOnly is initial. if gv_DynNum is initial. if gv_RepName cp '*=XT'. if gv_RepName cs '='. gv_RepName = gv_RepName(sy-fdpos). set parameter id 'XSLTNAME' field gv_RepName. call transaction 'XSLT_TOOL'. endif. else. set parameter id 'RID' field gv_RepName. call transaction 'SE38'. endif. else. set parameter id 'DYR' field gv_RepName. set parameter id 'DYN' field gv_DynNum. call transaction 'SE51'. endif. else. if gv_DynNum is initial. read report gv_RepName into gt_SrcCode. if sy-subrc <> 0. break-point. "#EC NOBREAK endif. else. gs_DynPro-Prog = gv_RepName. gs_DynPro-DNum = gv_DynNum. import dynpro gs_DynHeader gt_DynFields gt_DynLines gt_DynParams id gs_DynPro. if sy-subrc <> 0. break-point. "#EC NOBREAK endif. gt_SrcCode[] = gt_DynLines[]. endif. loop at gt_SrcCode. gv_SrcLine = sy-tabix. if gt_SrcCode-line(1) = '*'. write: / gv_SrcLine intensified off, gt_SrcCode-line color col_negative inverse on intensified off. else. write: / gv_SrcLine intensified off, gt_SrcCode-line intensified off. endif. endloop. if sy-lsind = 1. gv_ScrollPos = gv_LineNum - 24. if gv_ScrollPos < 1. gv_ScrollPos = 1. endif. call function 'LIST_SCROLL_LINE_TOPMOST' exporting list_index = 1 list_line = gv_ScrollPos. set cursor line gv_LineNum. endif. endif. clear gv_RepName. clear gv_DisplayOnly. endif.
1 Comment
Peter Inotai
Sorrry, but I don't really see the added value, as there are standard programs available for this:
Peter