terça-feira, 16 de maio de 2023

Text Symbols Where-Used List

 Searching and finding the exact word what you look for is so important in lots way. Most of cases ,we do not remember what the program or transaction was, we have been created before.Then we need a search tool. When we need to find a word contains in a report or function etc., there is a standard report ‘RPR_ABAP_SOURCE_SCAN’ . Using the report we could find a word or sentence in all program/function etc. in a system . In spite of the fact that,the report is the best way to find a word in all program, the report could not find a text symbol you have searched in a system. (I have had looked for a standard report or something in lots of versions of sap gui and could not find.If you know it already known like that,please feel free to comment down ). To stand in the breach, there is a code line “READ TEXTPOOL” and I have written a program to search text symbol in all program/function etc. in a system.

Find a word via “RPR_ABAP_SOURCE_SCAN” (already known before)

There is Sap Standard Report as ‘RPR_ABAP_SOURCE_SCAN’ to find the right report according to the word searched. The report is used to find exact word all over the SAP program or the program only starts with ‘Z’.

Basicly usage of ‘RPR_ABAP_SOURCE_SCAN’ is just so :

Firstly, we set the word what we want to search for ‘String searched for’ and ‘Z*’ for ‘Program Name’ (should set ‘Z*’ for quick answer)

Secondly, as a result (it is just a part of all result screen)

Find a text symbol via Z Report(newly created)

The report newly I have created has a simple selection screen and result alv . To find word considering text symbols whereever you want in a system, it is simply created and also can be developed.

Firstly, we set parameters

Secondly, run and the result of scan text symbols

 

The Codes:

REPORT  zos_test.

DATA : gs_rs38m TYPE rs38m.
DATA : gs_textpool TYPE textpool.

SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME.
SELECT-OPTIONS :
    s_prog FOR gs_rs38m-programm NO INTERVALS NO-EXTENSION OBLIGATORY,
    s_langu FOR sy-langu NO INTERVALS NO-EXTENSION DEFAULT 'EN',
    s_search FOR gs_textpool-entry NO INTERVALS NO-EXTENSION .
SELECTION-SCREEN END OF BLOCK b1.



*----------------------------------------------------------------------*
*       CLASS cl_txt_symbol_finder DEFINITION
*----------------------------------------------------------------------*
*
*----------------------------------------------------------------------*
CLASS cl_txt_symbol_finder DEFINITION FINAL.
  PUBLIC SECTION.
    METHODS : get_data ,
              alv_setup,
              display_alv.

  PRIVATE SECTION.
    TYPES : BEGIN OF gty_s_tadir,
          pgmid    TYPE tadir-pgmid   ,
          object   TYPE tadir-object  ,
          obj_name TYPE tadir-obj_name,
          END OF gty_s_tadir.

    TYPES : BEGIN OF gty_s_final,
            programm TYPE rs38m-programm,
            key      TYPE textpool-key,
            entry    TYPE textpool-entry,
            END OF gty_s_final.

    DATA: gt_texttab TYPE TABLE OF textpool .
    DATA: gs_texttab TYPE textpool .

    DATA  : gs_tadir TYPE gty_s_tadir,
        gt_tadir TYPE SORTED TABLE OF gty_s_tadir WITH UNIQUE KEY pgmid
            object obj_name.

    DATA : gs_final TYPE gty_s_final,
           gt_final TYPE TABLE OF gty_s_final.

    DATA : gr_cust_container TYPE REF TO cl_gui_custom_container,
           gr_alv_grid TYPE REF TO cl_gui_alv_grid.

    DATA : gs_fcat_lvc TYPE lvc_s_fcat,
           gt_fcat_lvc TYPE lvc_t_fcat.


ENDCLASS.                    "cl_txt_symbol_finder DEFINITION

*----------------------------------------------------------------------*
*       CLASS cl_txt_symbol_finder IMPLEMENTATION
*----------------------------------------------------------------------*
*
*----------------------------------------------------------------------*
CLASS cl_txt_symbol_finder IMPLEMENTATION.
  METHOD get_data.
    CLEAR gt_tadir.

    SELECT pgmid
           object
           obj_name
           FROM tadir
           INTO TABLE gt_tadir
           WHERE obj_name IN s_prog
           AND pgmid = 'R3TR'.

    LOOP AT gt_tadir INTO gs_tadir.
      gs_rs38m-programm = gs_tadir-obj_name.
   READ TEXTPOOL gs_rs38m-programm LANGUAGE s_langu-low INTO gt_texttab
   STATE 'A'.
      LOOP AT gt_texttab INTO gs_texttab
                         WHERE id = 'I' AND entry CS s_search-low.
        gs_final-programm = gs_tadir-obj_name.
        gs_final-key = gs_texttab-key.
        gs_final-entry = gs_texttab-entry.
        APPEND gs_final TO gt_final.
        CLEAR :gs_texttab,gs_final.
      ENDLOOP.
      CLEAR gs_tadir.
    ENDLOOP.
  ENDMETHOD.                    "get_data
  METHOD alv_setup.

    CREATE OBJECT gr_cust_container
       EXPORTING
*    PARENT                      =
         container_name              = 'CC_ALV'.

    CREATE OBJECT gr_alv_grid
      EXPORTING
        i_parent = gr_cust_container.

    gs_fcat_lvc-fieldname = 'PROGRAMM'.
    gs_fcat_lvc-tabname   = 'GT_FINAL'.
    gs_fcat_lvc-scrtext_s =
    gs_fcat_lvc-scrtext_m =
    gs_fcat_lvc-scrtext_l = 'Program'(001).
    APPEND gs_fcat_lvc TO gt_fcat_lvc.

    gs_fcat_lvc-fieldname = 'KEY'.
    gs_fcat_lvc-tabname   = 'GT_FINAL'.
    gs_fcat_lvc-scrtext_s =
    gs_fcat_lvc-scrtext_m =
    gs_fcat_lvc-scrtext_l = 'Key'(002).
    APPEND gs_fcat_lvc TO gt_fcat_lvc.

    gs_fcat_lvc-fieldname = 'ENTRY'.
    gs_fcat_lvc-tabname   = 'GT_FINAL'.
    gs_fcat_lvc-scrtext_s =
    gs_fcat_lvc-scrtext_m =
    gs_fcat_lvc-scrtext_l = 'Entry'(003).
    APPEND gs_fcat_lvc TO gt_fcat_lvc.
  ENDMETHOD.                    "alv_setup
  METHOD display_alv.
    CALL METHOD gr_alv_grid->set_table_for_first_display
      CHANGING
        it_outtab       = gt_final[]
        it_fieldcatalog = gt_fcat_lvc.
  ENDMETHOD.                    "display_alv
ENDCLASS.                    "cl_txt_symbol_finder IMPLEMENTATION

START-OF-SELECTION.


  DATA gr_txt_finder TYPE REF TO cl_txt_symbol_finder.
  CREATE OBJECT gr_txt_finder.

  CALL METHOD gr_txt_finder->get_data.
  CALL METHOD gr_txt_finder->alv_setup.
  CALL METHOD gr_txt_finder->display_alv.

  CALL SCREEN 0100.

 

Best Regards,

Source: https://blogs.sap.com/2018/04/18/text-symbols-where-used-list/

Nenhum comentário:

Postar um comentário