Skip to content

ABAP Keyword Documentation →  ABAP - Reference →  program editing →  Dynamic Program Editing →  Source Code 

READ REPORT

Short Reference

Other versions: 7.31 | 7.40 | 7.54

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 without secondary table keys and with character-type 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 raise a catchable exception.

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.


Notes

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.


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. 

Exceptions


Catchable Exceptions

CX_SY_READ_SRC_LINE_TOO_LONG

  • Cause: At least one line of the source code is longer than the rows of the internal table itab.
    Runtime Error: READ_REPORT_LINE_TOO_LONG

Continue

READ REPORT - internal addition