Application Development 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: 

how to read the program line

Former Member
0 Kudos

Hi all,

can one please let me know, how to read the program line by line,

it meanas.. if there is any hard code elements or write statements these have to be read and comparion should be done whether these r in englilsh language or not?

text message also have to be readed, these can be in other langugae also..

please let me know if any baody has come across this kind of scenario

Thanks

1 ACCEPTED SOLUTION

asik_shameem
Active Contributor
0 Kudos

Hi Tirumal,

Use the keyword

<b>SCAN ABAP-SOURCE</b> itab1 ...TOKENS INTO itab2

....STATEMENTS INTO itab3.

otherwise, u can use the keyword "<b>read report</b>", store them into an internal table and find.

reward if it helps.

regards,

sham.

4 REPLIES 4

asik_shameem
Active Contributor
0 Kudos

Hi Tirumal,

Use the keyword

<b>SCAN ABAP-SOURCE</b> itab1 ...TOKENS INTO itab2

....STATEMENTS INTO itab3.

otherwise, u can use the keyword "<b>read report</b>", store them into an internal table and find.

reward if it helps.

regards,

sham.

Former Member
0 Kudos

Syntax

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

Extras:

... MAXIMUM WIDTH INTO wid

Effect

This statement reads the source text of the program specified in prog from the Repository and copies its row into the internal table itab. The previous content of itab is deleted. If the program cannot be loaded, the content of itab remains unchanged.

For prog, you have to specify a flat character-type data object that contains the name of the program to be read (upper or lower case is irrelevant). The internal table itab must be a standard table with character-type (before release 6.10 flat) row type. When the row length of the internal table is fixed, it must be long enough for the longest program line. Program lines that are too long, are cut off to the right ; since release 6.10, a catchable exception occurs.

System fields

sy-subrc Relevance

0 The program was imported.

4 The specified program was not found in the repository.

8 The specified program is a system program protected against read access.

Addition

... MAXIMUM WIDTH INTO wid

Effect

If you use the addition MAXIMUM WIDTH, the number of characters of the longest imported source text row is assigned to the variable wid (expects the data type i, as of release 6.10) .

Example

After import of a program into the internal table itab, further lines are attached to the source text. After that, a temporary sub-routine-pool is generated from the changed program and one of its sub-programs called.

DATA prog TYPE c LENGTH 30.

DATA itab TYPE TABLE OF string.

prog = '...'.

READ REPORT prog INTO itab.

IF sy-subrc = 0.

APPEND 'FORM subr.' TO itab.

...

APPEND 'PERFORM ...' TO itab.

APPEND 'ENDFORM.' TO itab.

GENERATE SUBROUTINE POOL itab NAME prog.

PERFORM ('SUBR') IN PROGRAM (prog).

ENDIF.

Former Member
0 Kudos

Hi,


REPORT zreport NO STANDARD PAGE HEADING LINE-COUNT 44(3).

DATA : BEGIN OF itab OCCURS 100,
       rep TYPE char200,
       END OF itab.
DATA : prog TYPE sy-repid,
       reptab TYPE itab.

prog = 'ZREPORT'. "Report name which you want to read
READ REPORT prog INTO itab.
LOOP AT itab.
  MOVE itab TO reptab.
  "here each line of report copied to reptab line by line
  "here you can write your code
  WRITE 😕 reptab.
ENDLOOP.


Message was edited by:

Perez C

0 Kudos

Hi sham, Perez C , and karthikeyan,

Thanks for the quick Reply, from ur help i could be able to write entire program in to output, this is fine but my requirement is each and every word i have to compare with the german words.. suppose there is a possibility like

write : ' SAP HELP and one gernam word ' in this case i should be able to idetify the german word ..

my entire program has to be compared with german language, if there is any german word that should be displayed in the out put saying that This is german word 'XXXX'.

my logon on langugage is ENGLISH ONLY this should not be changed from ENGLISH TO GERMANY .. please let me know if any body has idea..

Client requriement is ' one of our german clinet is merged with UK client, but german client has developed SAP this clent has some of the write statements and text elements in GERMANY, since now it is merging with uk client he does'nt want it in GERMANY. HE wants to know what r the program have german words in it and what r those .so that he can change it easliy..

Thanks.

Tirumal