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

Scanning through code

Former Member
0 Likes
1,022

hi

I am trying to create a ZProgram A which will scan the code of another Z program B and check whether code standards are maintained in it or not.

So for this I need to copy the source code of Z Program B into Z Program A's internal table.

Can you help me how to get the source code into an internal table, I mean how to read it.

All helpful answers will be rewarded

1 ACCEPTED SOLUTION
Read only

RichHeilman
Developer Advocate
Developer Advocate
0 Likes
996

Sure use the READ REPORT statement.

Regards,

RIch Heilman

9 REPLIES 9
Read only

RichHeilman
Developer Advocate
Developer Advocate
0 Likes
997

Sure use the READ REPORT statement.

Regards,

RIch Heilman

Read only

Former Member
0 Likes
996

Hello,

Do like this:

Regards,

Vasanth


DATA itab TYPE string OCCURS 0 WITH HEADER LINE.

READ REPORT <prog> INTO itab.

LOOP AT itab.

IF sy-tabix = 25.
EXIT.
ELSE.
WRITE:/ itab.
ENDIF.

ENDLOOP.

Read only

ferry_lianto
Active Contributor
0 Likes
996

Hi,

Please check program RPR_ABAP_SOURCE_SCAN for logic to read source code.

Regards,

Ferry Lianto

Read only

Manohar2u
Active Contributor
0 Likes
996

Use

READ REPORT prog INTO itab. 

Reads the program prog from the database into the internal table itab. The line length of table itab should be at least 72 characters

Read only

RichHeilman
Developer Advocate
Developer Advocate
0 Likes
996

Something like this.



report zrich_0001.



data: begin of s occurs 0,
      txt(300) type c,
      end of s.

parameters: p_name(30) type c.

clear s. refresh s.
read report p_name into s.

loop at s.
  write:/ s-txt.
endloop.

Regards,

Rich Heilman

Read only

Former Member
0 Likes
996

Hi

Use the command

SCAN ABAP-SOURCE <PROGRAMNAME> TOKENS INTO ITAB2

STATEMENTS INTO ITAB3...

OR TRY THE FUN MODULE

RPR_ABAP_SOURCE_SCAN

Reward points for useful Answers

Regards

Anji

Read only

RaymondGiuseppi
Active Contributor
0 Likes
996

Try to use abap instruction :

READ REPORT prog INTO itab. 

Regards

Read only

0 Likes
996

To look into INCLUDES, check them in source OR better use transparent table D010INC.

Regards

Read only

Former Member
0 Likes
996

Thanks all