READ - Read a program

Basic form

READ REPORT prog INTO itab.

Addition:

1. ... STATE state 2. ... MAXIMUM WIDTH INTO w

Effect

Reads the program prog from the database into the internal table itab. The line length of table itab should be at least 72 characters.


The Return Code is set as follows:

SY-SUBRC = 0:
Program was read.
SY-SUBRC = 4:
Program could not be read because it does not exist.
SY-SUBRC = 8:
Program could not be read because it is a security-critical system program and therefore protected against read access.

Example

TYPES: BEGIN OF T_TYPE,
         LINE(72),
       END OF T_TYPE.
DATA: PROGRAM LIKE SY-REPID VALUE 'PROGNAME',
      T TYPE STANDARD TABLE OF T_TYPE WITH
             NON-UNIQUE DEFAULT KEY INITIAL SIZE 500.

READ REPORT PROGRAM INTO T.
IF SY-SUBRC <> 0.
  ...
ENDIF.

Addition

... STATE state

Note

This addition is intended for internal use. SAP reserves the right to make changes, which may be incompatible, at any time.

Effect

Programs can be saved in the library in their "active" or "inactive" form. This addition determines which state of the program 'prog' should be read. state may have the values A for active, or I for inactive. Inactive programs are only visible to the user currently working with them. All other users work with the active version of the program.

In the ABAP Workbench, you can define a list of objects being edited by each user. These programs are saved in their inactive form until they are activated. If you omit the STATE addition, the system automatically reads the inactive form of these programs, and the active form of all other programs.

Since this set of programs is only ever available at short notice within the ABAP Workbench, you can always be sure that other programs using the READ REPORT statement without the STATE addtion will always read "active" reports.

Addition 2

... MAXIMUM WIDTH INTO w

Effect

After the program has been read successfully from the library, w is filled with the length of the longest line of the source text, in characters.

Exceptions

Non-Catchable Exceptions

Related

INSERT REPORT, DELETE REPORT, SYNTAX-CHECK, GENERATE REPORT

Additional help

Reading and Changing Programs