The program helps search for strings in all the includes of SAPMV45A.
REPORT zgb_search_mv45a.
TYPES: BEGIN OF lty_coding_ext,
funcname TYPE trdir-name,
context(40) TYPE c,
lfdnr(5) TYPE n,
lineno(5) TYPE n,
codeline(255) TYPE c,
END OF lty_coding_ext.
TYPES: BEGIN OF lty_include,
include TYPE repid,
END OF lty_include.
DATA: lt_include TYPE TABLE OF lty_include.
DATA: lt_statement TYPE TABLE OF lty_coding_ext.
DATA: ls_statement TYPE lty_coding_ext.
DATA: ls_include TYPE lty_include.
DATA : lt_gen_limit TYPE TABLE OF progname.
DATA: lv_string TYPE string.
PARAMETERS:
pa_text TYPE char50 DEFAULT 'CONSTANTS'.
START-OF-SELECTION.
MOVE pa_text TO lv_string.
CALL FUNCTION 'RS_GET_ALL_INCLUDES'
EXPORTING
program = 'SAPMV45A'
* WITH_INACTIVE_INCLS = ABAP_FALSE
* WITH_RESERVED_INCLUDES = ABAP_FALSE
* WITH_CLASS_INCLUDES = ABAP_TRUE
* WITH_E_INCLUDES = ABAP_FALSE
TABLES
includetab = lt_gen_limit
EXCEPTIONS
not_existent = 1
no_program = 2
OTHERS = 3.
IF sy-subrc <> 0.
* Implement suitable error handling here
ENDIF.
LOOP AT lt_gen_limit ASSIGNING FIELD-SYMBOL(<lfs_gen_limit>).
IF <lfs_gen_limit>+0(1) = 'Y' OR <lfs_gen_limit>+0(1) = 'Z'.
ls_include-include = <lfs_gen_limit>.
APPEND ls_include TO lt_include.
ENDIF.
ENDLOOP.
*ls_include-include = 'ZOTCE0229_POE_FOR_RETURNS'.
*
*APPEND ls_include TO lt_include.
CALL FUNCTION 'AA_CUS_SCAN_PROG_FOR_STRING'
EXPORTING
id_string1 = lv_string
* ID_STRING2 = lv_string
* ID_PROGRAM =
* IMPORTING
* EF_FOUND =
TABLES
it_program = lt_include
et_coding = lt_statement.
*LOOP AT lt_statement INTO ls_statement.
* WRITE: / ls_statement-funcname,
* ls_statement-context,
* ls_statement-lfdnr,
* ls_statement-lineno,
* ls_statement-codeline.
*ENDLOOP.
*==============Display ALV==================*
DATA: gr_table TYPE REF TO cl_salv_table.
CALL METHOD cl_salv_table=>factory
IMPORTING
r_salv_table = gr_table
CHANGING
t_table = lt_statement. " Provide the table name
gr_table->get_columns( )->get_column( 'CODELINE' )->set_leading_spaces( abap_true ).
*... Display Table
gr_table->display( ).
No comments:
Post a Comment