*&---------------------------------------------------------------------*
*& 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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
7 | |
4 | |
4 | |
3 | |
3 | |
3 | |
3 | |
3 | |
3 | |
2 |