Google Search - Blog...........

ABAP - Search Text (Any) In Any Report Program Or Enhancements.

Description: I have got the requriement to search the hardcoded text into Z reports, enhancementes.

i really hate it to search manually in each and every report so I decided to work on some code.which do it for me.Only thing I have to do is to supply all the Z Reports and harcoded text as a Input.

Hey after posting this code I found code simliar to it in code galary Hard Coding Tracker Program but only think differs is this program is not consider the includes in the porgram.

Other program I found in code gallery is Search for Strings in ABAP Source Code which is used to search for strings in ABAP source code includes but still it totally different from this program.


REPORT zutil NO STANDARD PAGE HEADING.

SELECT-OPTIONS: so_repo FOR sy-repid.
PARAMETERS: pa_f_01 TYPE char20,
pa_f_02 TYPE char20.

DATA: gt_trdir TYPE STANDARD TABLE OF d010sinf.
FIELD-SYMBOLS: LIKE LINE OF gt_trdir.

TYPES: ty_tab(70) TYPE c.
DATA: gt_tab TYPE TABLE OF ty_tab.
FIELD-SYMBOLS: LIKE LINE OF gt_tab.

START-OF-SELECTION.

SELECT * FROM d010sinf INTO TABLE gt_trdir
WHERE prog IN so_repo
AND r3state = 'A' .
IF sy-subrc = 0.
LOOP AT gt_trdir ASSIGNING .

FORMAT COLOR COL_TOTAL ON.
WRITE:/ 'PROGRAM: ',-prog.
FORMAT COLOR OFF.

PERFORM get_includes USING -prog.

PERFORM read_repo USING -prog.
ENDLOOP.
ENDIF.


END-OF-SELECTION.

AT LINE-SELECTION.
DATA: lv_name TYPE programm.
lv_name = sy-lisel+9.
CONDENSE lv_name.
SET PARAMETER ID 'RID' FIELD lv_name.
CALL TRANSACTION 'SE38' AND SKIP FIRST SCREEN.


*---------------------------------------------------------------------*
* FORM get_includes *
*---------------------------------------------------------------------*
* ........ *
*---------------------------------------------------------------------*
* --> PROG *
*---------------------------------------------------------------------*
FORM get_includes USING prog.
DATA: gt_trdirt TYPE TABLE OF trdirt.
FIELD-SYMBOLS: LIKE LINE OF gt_trdirt.


CALL FUNCTION 'MWGT_SEARCH_INCLUDES'
EXPORTING
i_progr = prog
TABLES
o_incl_progs = gt_trdirt
EXCEPTIONS
prog_not_exist = 1
prog_has_no_coding = 2
OTHERS = 3.
IF sy-subrc = 0.
LOOP AT gt_trdirt ASSIGNING .
PERFORM get_includes USING -name.
PERFORM read_repo USING -name.
ENDLOOP.
ENDIF.
ENDFORM.



*---------------------------------------------------------------------*
* FORM read_repo *
*---------------------------------------------------------------------*
* ........ *
*---------------------------------------------------------------------*
* --> PROG *
*---------------------------------------------------------------------*
FORM read_repo USING prog.

READ REPORT prog INTO gt_tab.
IF sy-subrc = 0.
LOOP AT gt_tab ASSIGNING .
SEARCH FOR pa_f_01.
IF sy-subrc = 0.
FORMAT COLOR COL_KEY ON.
WRITE:/ 'INCLUDE: ', prog HOTSPOT.
FORMAT COLOR OFF.
WRITE:/ sy-tabix,.
ENDIF.

SEARCH FOR pa_f_02.
IF sy-subrc = 0.
FORMAT COLOR COL_KEY ON.
WRITE:/ 'INCLUDE: ', prog HOTSPOT.
FORMAT COLOR OFF.
WRITE:/ sy-tabix,.
ENDIF.


ENDLOOP.
ENDIF.
ENDFORM.

No comments:

Post a Comment