Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

program to get tables used in reports

Former Member
0 Kudos
1,410

Hi,

My Requirement is to fetch all custom programs from TADIR table and want to display in a report format.

If i click on a program i want to get a a diagram consist of tables used in that report with ralations it's just like table relation in SQ02.

Anyone tell me is there any standard function module in sap.

and Is there any function module giving table names if we give a program name otherthan GET_TABLES

Thanks & Regards,

Laxmi

3 REPLIES 3

Former Member
0 Kudos
315

hi

use this fm RS_PROGRAM_TABLES or you can do one more thing

go to transaction se 38 then go to utilities->cross reference->database operations

then go to se49

hope it helps

regards

Aakash Banga

Former Member
0 Kudos
315

there is no such f.m

below report will give all table details for program or for t.code

TABLES : DD03l, DD02l.

DATA : Program like sy-repid.

DATA : BEGIN OF I_FINAL OCCURS 0,

tabname LIKE dd02l-tabname,

TABCLASS LIKE dd02l-tabCLASS,

TEXT LIKE DD02T-DDTEXT,

END OF I_FINAL.

DATA : BEGIN of ITAB Occurs 0,

name like dd02l-tabname,

END OF ITAB.

DATA : TCD(100) TYPE C.

DATA : var1 LIKE dd02l-tabname.

DATA : DESC LIKE TSTCT-TTEXT.

*SELECTION SCREEN

selection-screen skip.

SELECTION-SCREEN : BEGIN OF BLOCK b2 WITH FRAME TITLE text-002.

PARAMETERS : r1 RADIOBUTTON GROUP r DEFAULT 'X'.

Parameters : Tcode like sy-tcode.

selection-screen skip.

PARAMETERS : r2 RADIOBUTTON GROUP r.

Parameters : Prog like sy-repid.

SELECTION-SCREEN END OF BLOCK b2.

SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE text-001.

select-options : Type for dd02l-tabclass .

SELECTION-SCREEN END OF BLOCK B1 .

*AT SELECTION SCREEN *

at selection-screen.

if r1 = 'X' and Tcode is initial.

message e001(00) with 'Enter Transaction Code' .

elseif r2 = 'X' and Prog is initial.

message e001(00) with 'Enter Program Name' .

endif.

  • START OF SELECTION *

START-OF-SELECTION.

if r1 = 'X'.

Prog = ' '.

select single * from TSTC where tcode = tcode.

if sy-subrc = 0.

program = TSTC-PGMNA.

select single TTEXT from tstct into desc where tcode = tcode and SPRSL = 'E'.

else.

Write 😕 'Invalid Transaction Code'.

exit.

endif.

elseif r2 = 'X'.

Tcode = ' '.

program = Prog.

endif.

CALL FUNCTION 'GET_TABLES'

EXPORTING

PROGNAME = Program

TABLES

TABLES_TAB = itab.

if itab is initial.

skip.

skip.

skip.

skip.

skip.

WRITE :/40 'No Data Found' color 6 INTENSIFIED OFF.

ELSE.

PERFORM : categorize.

endif.

  • END OF SELECTION *

END-OF-SELECTION.

LOOP AT I_FINAL.

WRITE :/4 I_FINAL-tabname COLOR 2 INTENSIFIED OFF NO-GAP HOTSPOT ON, 35 I_FINAL-TABCLASS COLOR 2 INTENSIFIED OFF NO-GAP,

50 I_FINAL-TEXT COLOR 2 INTENSIFIED OFF NO-GAP.

ENDLOOP.

  • AT LINE SELECTION *

AT LINE-SELECTION.

TCD = SY-LISEL.

var1 = TCD+3(30).

set parameter id 'DTB' FIELD VAR1.

call transaction 'SE11' and skip first screen.

  • TOP OF PAGE *

TOP-OF-PAGE.

WRITE :/45 'TABLE DETAILS RELATED TO THE TRANSACTION CODE' COLOR 7 .

WRITE :/2 'DATE : ' COLOR 1, SY-DATUM COLOR 1 INTENSIFIED OFF NO-GAP.

WRITE :/2 'TRANSACTION CODE : ' COLOR 1, Tcode COLOR 1 INTENSIFIED OFF NO-GAP.

WRITE :/2 'TCODE DESCRIPTION : ' COLOR 1, desc COLOR 1 INTENSIFIED OFF NO-GAP.

WRITE :/2 'PROGRAM NAME : ' COLOR 1, PROGRAM COLOR 1 INTENSIFIED OFF NO-GAP.

SKIP 1.

WRITE :/1(140) SY-ULINE.

WRITE :/4 'TABLE NAME' COLOR 5 INTENSIFIED OFF NO-GAP,35 'TABLE TYPE' COLOR 5 INTENSIFIED OFF NO-GAP,

55 'DESCRIPTION' COLOR 5 INTENSIFIED OFF NO-GAP.

WRITE :/1(140) SY-ULINE.

.

FORM categorize .

SELECT dd02ltabname dd02ltabCLASS DD02T~DDTEXT

FROM dd02l INNER JOIN DD02T ON dd02ltabname = dd02Ttabname

INTO TABLE I_FINAL

FOR ALL ENTRIES IN itab

WHERE DD02L~TABNAME = ITAB-NAME AND TABCLASS IN TYPE AND DDLANGUAGE = 'E'.

if sy-subrc <> 0.

skip.

skip.

skip.

skip.

skip.

WRITE :/40 'No Data Found' color 6 INTENSIFIED OFF.

endif.

ENDFORM.

Former Member
0 Kudos
315

Use the FM - RS_GET_PROGRAM_TABLES_FIELDS