Application Development and Automation 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: 
Read only

abap code

Former Member
0 Likes
820

with the program id as the input can i read the contents of the program ,if so pls let me the logic?

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
784

Hi ,

You can use the FM RV_REPORT_READ , to read source code using the program name.

Regards,

Arun

6 REPLIES 6
Read only

Sm1tje
Active Contributor
0 Likes
784

F1 HELP!!!!

 READ REPORT prog INTO itab [MAXIMUM WIDTH INTO wid]. 

Read only

Former Member
0 Likes
785

Hi ,

You can use the FM RV_REPORT_READ , to read source code using the program name.

Regards,

Arun

Read only

Former Member
0 Likes
784

i cant understand what u mean by read .

read is used for the reading the contents of an internal table right

what is that report ?

Read only

0 Likes
784

Again F1 help will tell you that in REPORT prog, prog is the name of your program, or as you like to call it, PROGRAM ID.

The source will be read into an internal table.

Uwe's suggestion would be even 'better', or let me put it another way: More 'up to date', since he uses the Object Oriented way or retrieving the source code.

Read only

uwe_schieferstein
Active Contributor
0 Likes
784

Hello

You can use class CL_WB_SOURCE for your purpose:


DATA:
  go_source     TYPE REF TO cl_wb_source,
  gt_code         TYPE TABLE OF string.

  CREATE OBJECT go_source
    IMPORTING
      source_name = '<name of your report>'.

  CALL METHOD go_source->get_source_tab
    EXPORTING
      source = gt_code.

Regards

Uwe

Read only

Former Member
0 Likes
784

Haii,

Go through this program..its a simple program which searches for a text in entire Report. So ur requirement is almost fulfilled here i guess. You just need to remove the search functionality in this program and thats it.

*********************************

REPORT ZRAMA_BISPIEL.

TABLES: trdir.

PARAMETER : pa_text(30) type c.

SELECT-OPTIONS : so_name FOR trdir-name MATCHCODE OBJECT zsh_example.

data: begin of jtab occurs 0,

line(300),

end of jtab.

data : wa like jtab.

DATA : rata LIKE trdir OCCURS 0 WITH HEADER LINE.

DATA : repid type sy-repid.

DATA : fval type trdir-name.

DATA : cnt type n.

DATA : off type n.

SELECT name FROM trdir INTO rata WHERE name IN so_name.

append rata.

ENDSELECT.

WRITE: /02 'PrgName', 53 'Text',95 'Line No'.

uline.

LOOP AT rata.

read report rata-name into jtab.

jtab-line = rata-name.

append jtab.

search jtab for pa_text.

if sy-subrc = 0.

WRITE : /02 rata-name, 50 pa_text,90 sy-tabix.

endif.

ENDLOOP.

AT LINE-SELECTION.

get cursor value fval.

EDITOR-CALL FOR REPORT fval DISPLAY-MODE.

**************************************************************

Cheers,

r a m a . .

Edited by: newtoAbap on Mar 13, 2009 11:06 AM