Report to search ABAP code in Enhancement implementations

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.
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值