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

Issues while using READ REPORT 'rep' INTO 'itab'

Former Member
0 Likes
1,385

Hello,

I have a requirement where in I need to read a report and then further process it. I then need to read the lines of the report and take some variables based on the calls my read report has made.

Issue I am facing here is when I tried to read the report it took it as it is in my ITAB but not as each executable line in one line. For example:

REP1 has a concatenate statement which I have written like below

CONCATENATE

                         'This is Output.'

                         var1 var2

                         into var3

                         separated by space.

Now when I read this REP1 in my REP2 I got these lines like this itself rather I want it like one executable mine in one line. My requirement is to read one executable line at a time and process it.

So my read report internal table should give me:

CONCATENATE 'This is Output.' var1 var2 into var3 separated by space.

Likewise I may have any number of lines and any number of statements.

Is there any way to achieve this requirement? Pls help !!

Thanks

Harjeet

11 REPLIES 11
Read only

Former Member
0 Likes
1,340

I'm struggling with the English and lack of grammar in this post but let me try.

Every ABAP statement has to end with the '.' char meaning period. You could simply concatenate rows of the itab until the last non-whitespace char is '.' and then start with the next set of rows in the itab. The output will look silly for example conditions which span several rows, SELECT statements, etc. but if that is what you want that is what you will get.

Read only

0 Likes
1,340

Hello Samuli,

You got the question right. We are not in a Grammer forum.

Moreover the solution you proposed is not feasible since there may be million lines of code and I can't do that everywhere. If I search for period also like in my example then I will get 2 instances of it. My program will do many other stuff and for that I want this output. If I struggle this much for to get it then other functionality may go for a toss.

So the conclusion is I cannot think of your option at all.

Read only

Former Member
0 Likes
1,340

hello,

did you try FM 'RPY_PROGRAM_READ' ?

best regards

swanand

Read only

0 Likes
1,340

Hello Swanand,

Thanks for your response.

Unfortunately FM works similar to READ REPORT syntax. It also doesn't display one executable line in one line of ITAB.

Read only

0 Likes
1,340

In your program if the "downward compatible length is set to 72" then your statement will work as you desired. For example RFC_READ_DEVELOPMENT_OBJECT works fine if the compatible length is set to 72.

Read only

0 Likes
1,340

Hello Kesav,

Did you tried the same? Because this FM will through runtime error if code length is more than 72. I even tried this FM and it did read my program but in the same way READ REPORT did.

No change at all.

Thanks for your efforts though

Read only

Former Member
0 Likes
1,340

Did anyone here knows how to achieve it? I need to get the solution but still sitting helpless

Read only

0 Likes
1,340

I already gave you the answer you are just refusing to accept it because it will require effort on your part. The argument of having millions of lines of code is just bogus and so is the one that concatenating the rows is not possible because there can be periods in the code lines before the period for the ABAP statement. You can always check for different conditions while parsing. There are several parsing implementations in the standard system, check for example the ABAP classes for HTML to STRING conversions. The result won't be nice but that is what you are asking for. If you were more specific on your requirement ("do more stuff" is not specific) maybe people on SCN could suggest a better solution for you.

Read only

0 Likes
1,340

Bro, Don't get personal. I am not working on some stupid requirement of getting this output.

I am creating a tool which will have many functionalities that standard SAP doesn't provide. Now when I say that, than it means that my tool is already working on many other stuff and the reason I am not applying your suggestion is because it will drop its performance further.

So many thanks for your suggestion and Unfortunately I knew it before raising this question here, but I can't apply..

Thanks Again.

Read only

AndrewBarnard
Contributor
0 Likes
1,340

You might wish to explore the ABAP command SCAN ABAP-SOURCE.. It breaks down the ABAP-SOURCE into statements and token.  From this information, you could re-build the source the way you want it.

Again - not exactly what you are looking for, but it does give you a consistent basis to build the format you are seeking.

Read only

0 Likes
1,340

Yeah Andrew, At present I am doing like concatenating based on the period but its useless when it comes with comments or constants. I am already looping my whole code line by line with these conditions, which is tough for performance.

If there could be any specific way then it would have helped a lot.