Find Word in ABAP Program

Objektif

Menemukan Kata dalam ABAP Program

Kode Transaksi

SE38 - ABAP Editor

Support


Kontributor

Kristian Fredy ( fredy.kristian@gmail.com )

Seleksi Input

abtl0012

Output

abtl0013


Source Code

*&---------------------------------------------------------------------*

*& Report YABAP_TOOLS_FIND_WORD_IN_ABAP *

*& *

*&---------------------------------------------------------------------*

*& Created By : Kristian Fredy *

*& Date : 02.01.2010 *

*&---------------------------------------------------------------------*

REPORT yabap_tools_find_word_in_abap NO STANDARD PAGE HEADING.

* Guna Program ini adalah :

* mencari minimum 1 lokasi kata yang diinginkan

SELECT-OPTIONS : s_prog FOR sy-repid, "Nama Program

s_author FOR sy-uname. "creator / author

PARAMETERS : p_word(72) LOWER CASE. "kata yang dicari

TABLES : trdir,

tstc,

tstct.

DATA : dg_describe_field TYPE i,

dg_type,

dg_color.

DATA : BEGIN OF t_trdir OCCURS 0,

name LIKE trdir-name,

END OF t_trdir.

DATA : BEGIN OF itab OCCURS 0,

isi_baris_program(1000), "minimum 72 digits

END OF itab.

DATA : BEGIN OF itab_hasil OCCURS 0,

nama_program LIKE sy-repid,

posisi_baris_dlm_program LIKE sy-tabix,

END OF itab_hasil.

DATA : prog(40),

dg_text(80).

AT LINE-SELECTION.

* DESCRIBE FIELD sy-lisel LENGTH dg_describe_field TYPE dg_type.

* WRITE: 'SY-LSIND:', sy-lsind,

* / 'SY-LISTI:', sy-listi,

* / 'SY-LILLI:', sy-lilli,

* / 'SY-CUROW:', sy-curow,

* / 'SY-CUCOL:', sy-cucol,

* / 'SY-CPAGE:', sy-cpage,

* / 'SY-STARO:', sy-staro,

* / 'SY-LISEL:', 'Length =', dg_describe_field, 'Type =', dg_type,

* / sy-lisel.

EDITOR-CALL FOR REPORT

sy-lisel+2(40) DISPLAY-MODE.

TOP-OF-PAGE.

PERFORM print_header.

INITIALIZATION.

START-OF-SELECTION.

SELECT name

INTO CORRESPONDING FIELDS OF TABLE t_trdir

FROM trdir

WHERE name IN s_prog AND

cnam IN s_author.

LOOP AT t_trdir.

READ REPORT t_trdir-name INTO itab.

LOOP AT itab WHERE isi_baris_program CS p_word.

itab_hasil-nama_program = t_trdir-name.

itab_hasil-posisi_baris_dlm_program = sy-tabix.

APPEND itab_hasil.

EXIT.

ENDLOOP.

ENDLOOP.

LOOP AT itab_hasil.

CLEAR tstc-tcode.

SELECT SINGLE tcode INTO tstc-tcode

FROM tstc

WHERE pgmna EQ itab_hasil-nama_program.

CLEAR tstct-ttext.

SELECT SINGLE ttext INTO tstct-ttext

FROM tstct

WHERE sprsl EQ 'EN' AND

tcode EQ tstc-tcode.

IF dg_color EQ space.

dg_color = 'X'.

FORMAT COLOR COL_NORMAL INTENSIFIED ON.

ELSE.

CLEAR dg_color.

FORMAT COLOR COL_NORMAL INTENSIFIED OFF.

ENDIF.

WRITE :/ '|',

(40) itab_hasil-nama_program,

'|',

(20) tstc-tcode,

'|',

(36) tstct-ttext,

'|',

(30) itab_hasil-posisi_baris_dlm_program,

'|'.

AT LAST.

ULINE (139).

ENDAT.

ENDLOOP.

*&---------------------------------------------------------------------*

*& Form print_header

*&---------------------------------------------------------------------*

* text

*----------------------------------------------------------------------*

* --> p1 text

* <-- p2 text

*----------------------------------------------------------------------*

FORM print_header.

WRITE :/(80) 'HASIL PENCARIAN (Minimum 1 Lokasi)' CENTERED.

CONCATENATE 'Kata :' '"' p_word '"' INTO dg_text SEPARATED BY space.

WRITE :/(80) dg_text CENTERED.

SKIP 1.

ULINE (139).

FORMAT COLOR COL_HEADING INTENSIFIED ON.

WRITE :/ '|',

(40) 'Nama Program' CENTERED,

'|',

(20) 'T-Code' CENTERED,

'|',

(36) 'Deskripsi T-Code' CENTERED,

'|',

(30) 'Posisi Baris Dalam Program' CENTERED,

'|'.

ULINE (139).

ENDFORM. " print_header


Comments