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

Report Analyser

Former Member
0 Likes
785

Hi everyone,

I have a program, which uses "READ REPORT" (gets the code of a report in an internal table). Now I want to loop at the internal table to find blocks of code ... just like loop - endloop. Any Idea how to realize this?

Best regards!

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
751

Hi,

Use below code.

DATA prog(30) TYPE c.

DATA WA TYPE STRING.

DATA itab TYPE TABLE OF string.

PROG = 'ZSAMPLE' "REPORT NAME

READ REPORT prog INTO itab.

LOOP AT ITAB INTO WA.

ENDLOOP.

REGARDS,

MURALII

Hi everyone,

I have a program, which uses "READ REPORT" (gets the code of a report in an internal table). Now I want to loop at the internal table to find blocks of code ... just like loop - endloop. Any Idea how to realize this?

Best regards!

5 REPLIES 5
Read only

Former Member
0 Likes
752

Hi,

Use below code.

DATA prog(30) TYPE c.

DATA WA TYPE STRING.

DATA itab TYPE TABLE OF string.

PROG = 'ZSAMPLE' "REPORT NAME

READ REPORT prog INTO itab.

LOOP AT ITAB INTO WA.

ENDLOOP.

REGARDS,

MURALII

Read only

0 Likes
751

Sorry, maybe I expressed myself not clearly enough... I know how to loop at an internal table But I want to find out at which line of the internal table a block of code starts and where it ends. Example:


Loop.  " Start Block 1
   Loop.  " Start Block 2
       If.  " Start Block 3
       Endif.  " End Block 3
   Endloop.  " End Block 2
Loop.  " End Block 1

Edited by: Fabian Vogt on Sep 20, 2011 1:48 PM

Read only

0 Likes
751

Hi

Split the line into table where space

LOOP AT ITAB INTO WA.

SPLIT WA AT SPACE INTO TABLE ITAB1.

LOOP AT ITAB1 INTO WA1.

AT FAST.

"FIRST BLOCK.

ENDAT.

AT LAST.

"LAST BLOCK.

ENDAT.

ENDLOOP.

ENDLOOP.

REGARDS.

MURALI

Read only

0 Likes
751

I think it is too tedious to use the result of READ REPORT for your purpose, you might want to look at the SCAN statement.

http://help.sap.com/abapdocu_702/en/abapscan.htm

It takes a while to figure out how it works, but it is quite powerful. SAP flags it as "internal use only", so use it at your own risk.

Thomas

Read only

Former Member
0 Likes
751

Hi

U need to use command like SEARCH in order to get out a certain value of a string (in your case the line of abap code)

Max