Technology Blogs by Members
Explore a vibrant mix of technical expertise, industry insights, and tech buzz in member blogs covering SAP products, technology, and events. Get in the mix!
cancel
Showing results for 
Search instead for 
Did you mean: 
Joris
Explorer
With SAP Standard report RS_ABAP_SOURCE_SCAN or the SAP Code Inspector (transaction SCI) it is not possible to do text based searches through Enhancement Implementations

Inspired by the archived discussion here, I put together below little ABAP code scanner for Enhancement implementations.

Features

  • Full Text search in ABAP code inside implicit- and explicit Enhancement implementations/spots.

  • Limit search range by Development Package

  • Simple list output with matching enhancements & line of code where hit occurred

  • No further fancy stuff.


Enjoy
*&---------------------------------------------------------------------*
*& Report Z_SCAN_ENHANCEMENTS
*&---------------------------------------------------------------------*
*& Search enhencement implementation code for given string.
*& Joris Bots - July 2018
*&---------------------------------------------------------------------*
REPORT z_scan_enhancements.
DATA lv_percentage TYPE i.
DATA lv_old_percentage TYPE i.
DATA lv_text TYPE c LENGTH 150.
DATA ls_enhincinx TYPE enhincinx.
DATA lt_enhincinx TYPE STANDARD TABLE OF enhincinx.
DATA lt_source TYPE abaptxt255_tab.
DATA lt_results TYPE match_result_tab.

PARAMETERS p_srch TYPE string.
PARAMETERS p_class TYPE devclass.

START-OF-SELECTION.

"Accept wildcards for dev class || set wildcard for all
IF p_class IS INITIAL.
p_class = '%'.
ELSE.
REPLACE ALL OCCURRENCES OF '*' IN p_class WITH '%'.
ENDIF.

"Get all enhancement spots that are in the selected dev class
SELECT e~* FROM
enhincinx AS e
INNER JOIN tadir AS t ON 'R3TR' = t~pgmid
AND 'ENHO' = t~object
AND e~enhname = t~obj_name
WHERE t~devclass LIKE @p_class
INTO TABLE @lt_enhincinx.


LOOP AT lt_enhincinx ASSIGNING FIELD-SYMBOL(<ls_enhincinx>).

"Talk to the user
lv_percentage = sy-tabix * 100 / lines( lt_enhincinx ).
lv_text = |Searching Enhancements ({ sy-tabix }/{ lines( lt_enhincinx ) })...|.
IF lv_old_percentage <> lv_percentage.
CALL FUNCTION 'SAPGUI_PROGRESS_INDICATOR'
EXPORTING
percentage = lv_percentage
text = lv_text.
lv_old_percentage = lv_percentage.
ENDIF.

READ REPORT <ls_enhincinx>-enhinclude INTO lt_source.

CLEAR lt_results.
FIND ALL OCCURRENCES OF p_srch IN TABLE lt_source
IN CHARACTER MODE
IGNORING CASE
RESULTS lt_results.

IF lt_results IS NOT INITIAL.
SKIP.
WRITE: / '++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++'.
WRITE: / |{ <ls_enhincinx>-programname } / { <ls_enhincinx>-full_name } / { <ls_enhincinx>-enhname }:|.
ENDIF.
LOOP AT lt_results ASSIGNING FIELD-SYMBOL(<ls_result>).
WRITE 😕 lt_source[ <ls_result>-line ]-line.
ENDLOOP.
ENDLOOP.
7 Comments
Labels in this area