Find Table in ABAP Program

Objektif

Menemukan Table dalam ABAP Program

Kode Transaksi

SE38 - ABAP Editor

Support

Kontributor

Kristian Fredy ( fredy.kristian@gmail.com )

Seleksi Input

abtl0014

Output

abtl0015

abtl0016


Source Code

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

*& Report YABAP_TOOLS_FIND_TABLE_IN_ABAP *

*& *

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

*& Created By : Kristian Fredy *

*& Date : 02.01.2010 *

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

REPORT yabap_tools_find_table_in_abap

NO STANDARD PAGE HEADING

LINE-SIZE 255.

* guna program ini adalah :

* me-list semua tabel-tabel yang digunakan dalam program.

TABLES : trdir,

trdirt,

tadir, "u/ mengetahui development class program tsb

tstc, "table tcode

tstct. "table text tcode

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

PARAMETERS : p_table(72). "kata yang dicari

DATA : BEGIN OF t_trdir OCCURS 0,

name LIKE trdir-name,

cnam LIKE trdir-cnam,

unam LIKE trdir-unam,

END OF t_trdir.

DATA : BEGIN OF itab OCCURS 0,

isi_baris_program(100), "minimum 72 digits

END OF itab.

DATA : BEGIN OF itab_hasil OCCURS 0,

nama_program LIKE sy-repid,

descripsi_program LIKE trdirt-text,

tcode LIKE tstc-tcode,

descripsi_tcode LIKE tstct-ttext,

posisi_baris_dlm_program LIKE sy-tabix,

author LIKE trdir-cnam,

last_change_by LIKE trdir-unam,

END OF itab_hasil.

DATA : prog(40),

dg_text(80).

DATA : itab_ddnm LIKE rddnm OCCURS 0 WITH HEADER LINE.

AT LINE-SELECTION.

EDITOR-CALL FOR REPORT

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

TOP-OF-PAGE.

PERFORM print_header.

INITIALIZATION.

START-OF-SELECTION.

SELECT name

cnam

unam

INTO CORRESPONDING FIELDS OF TABLE t_trdir

FROM trdir

WHERE name IN s_prog.

LOOP AT t_trdir.

LOAD REPORT t_trdir-name PART 'DDNM' INTO itab_ddnm.

LOOP AT itab_ddnm WHERE tabname EQ p_table.

itab_hasil-nama_program = t_trdir-name.

itab_hasil-author = t_trdir-cnam.

itab_hasil-last_change_by = t_trdir-unam.

CLEAR itab_hasil-descripsi_program.

SELECT SINGLE text INTO itab_hasil-descripsi_program

FROM trdirt WHERE name = t_trdir-name.

CLEAR itab_hasil-tcode.

SELECT SINGLE tcode INTO itab_hasil-tcode

FROM tstc WHERE pgmna = t_trdir-name.

CLEAR itab_hasil-descripsi_tcode.

SELECT SINGLE ttext INTO itab_hasil-descripsi_tcode

FROM tstct WHERE sprsl = 'EN' AND

tcode = itab_hasil-tcode.

itab_hasil-posisi_baris_dlm_program = sy-tabix.

APPEND itab_hasil.

EXIT.

ENDLOOP.

ENDLOOP.

LOOP AT itab_hasil.

WRITE :/ '|',

(40) itab_hasil-nama_program,

'|',

(70) itab_hasil-descripsi_program,

'|',

(20) itab_hasil-tcode,

'|',

(36) itab_hasil-descripsi_tcode,

'|',

(12) itab_hasil-author,

'|',

(15) itab_hasil-last_change_by,

'|',

(30) itab_hasil-posisi_baris_dlm_program,

'|'.

AT LAST.

ULINE (245).

ENDAT.

ENDLOOP.

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

*& Form print_header

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

* text

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

* --> p1 text

* <-- p2 text

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

FORM print_header.

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

CONCATENATE 'Tabel :' '"' p_table '"' INTO dg_text SEPARATED BY space.

WRITE :/(245) dg_text CENTERED.

SKIP 1.

ULINE (245).

WRITE :/ '|',

(40) 'Nama Program' CENTERED,

'|',

(70) 'Deskripsi Program' CENTERED,

'|',

(20) 'T-Code' CENTERED,

'|',

(36) 'Deskripsi T-Code' CENTERED,

'|',

(12) 'Author' CENTERED,

'|',

(15) 'Last Change By' CENTERED,

'|',

(30) 'Posisi Baris Dalam Program' CENTERED,

'|'.

ULINE (245).

ENDFORM. " print_header

Comments