07-30-2009 10:21 AM
Dear All,
I have a requirement where i need to read the source code of a report into an internal table along with the line number.
We have READ REPORT programname INTO tablename but in this case i will get only the source code.
Ex : If the source code of programname is
DATA : a TYPE c,
b TYPE c,
c TYPE c.
a = 'A'.
b = 'B'.
CONCATENATE a b INTO C.
WRITE: c.
If i do a read report for the above program i will get output in my table as
TEXT LINENO
DATA : a TYPE c,
b TYPE c,
c TYPE c.
a = 'A'.
b = 'B'.
CONCATENATE a b INTO C.
WRITE: c.
What i need is something like the below.
TEXT LINENO
DATA : a TYPE c, 1
b TYPE c, 2
c TYPE c. 3
a = 'A'. 4
b = 'B'. 5
CONCATENATE a b INTO C. 6
WRITE: c. 7
I dont want to do a loop and add line numbers to each line as it may take time when the souce code is large.
Thanks,
Hari Prasad
07-30-2009 10:24 AM
you already have a field called sy-tabix which can give the particular line number any time you need.
what exactly you need with this line number?
07-30-2009 10:29 AM
Hi,
Add one more component to ur internal table which holds the line number
Like, LIneno type i.
Populate sy-tabix into this field.
Regards,
Lakshman.
07-30-2009 10:30 AM
07-30-2009 10:49 AM
Hi ,
Check out this prog , we can easily display the line no .
REPORT ZDEMO .
TYPES: BEGIN OF T_TYPE,
LINE(72),
END OF T_TYPE.
DATA: PROGRAM LIKE SY-REPID VALUE 'YSCR_RPTRD00006_HOT_PICK',
ITAB TYPE STANDARD TABLE OF T_TYPE WITH
NON-UNIQUE DEFAULT KEY INITIAL SIZE 500 ,
WA TYPE T_TYPE.
READ REPORT PROGRAM INTO ITAB.
IF SY-SUBRC = 0.
LOOP AT ITAB INTO WA.
WRITE 😕 sy-tabix ,WA-LINE .
ENDLOOP.
ENDIF.
Regards ,
Rajesh .
07-30-2009 11:04 AM
>
> Hi ,
>
> Check out this prog , we can easily display the line no .
>
>
REPORT ZDEMO . > > TYPES: BEGIN OF T_TYPE, > LINE(72), > END OF T_TYPE. > > DATA: PROGRAM LIKE SY-REPID VALUE 'YSCR_RPTRD00006_HOT_PICK', > ITAB TYPE STANDARD TABLE OF T_TYPE WITH > NON-UNIQUE DEFAULT KEY INITIAL SIZE 500 , > WA TYPE T_TYPE. > > READ REPORT PROGRAM INTO ITAB. > IF SY-SUBRC = 0. > LOOP AT ITAB INTO WA. > WRITE 😕 sy-tabix ,WA-LINE . > ENDLOOP. > ENDIF.
>
>
> Regards ,
> Rajesh .
You are anyway looping the full report. Which he does not want.