MODIFY - Change a List Line

Variants:

1. MODIFY LINE n.

2. MODIFY LINE n OF CURRENT PAGE.

3. MODIFY LINE n OF PAGE m.

4. MODIFY CURRENT LINE.

Variant 1

MODIFY LINE n.

Extras:

1. ... INDEX idx

2. ... LINE  FORMAT fmt1 ... fmtn

3. ... FIELD FORMAT f1 fmt11 ... fmt1m ... fn fmtn1 ... fmtnm

4. ... LINE  VALUE FROM wa

5. ... FIELD VALUE f1 FROM g1 ... fn FROM gn

Effect

Changes the nth ine of the list, usually following a line selection ( AT LINE-SELECTION, AT PFxx, AT USER-COMMAND).
The current contents of the system field SY-LISEL is inserted into the list, the HIDE area for the line is filled with the current contents of the fields hidden by HIDE.

The Return Code is set as follows:

SY-SUBRC = 0:
The line was changed.
SY-SUBRC <> 0:
The line was not changed.

Notes

In a multi-level line selection, the last list from which a line was chosen is always the one to be modified (exceptions: with the... INDEX idx and MODIFY CURRENT LINE additions. See below.)

System fields that are useful in interactive reporting are contained in the system fields for lists documentation.

Addition 1

... INDEX idx

Effect

Changes the corresponding line in the list at list level idx (0, 1, 2, ...) where there is more than one list level. (SY-LSIND).

Addition 2

... LINE FORMAT fmt1 ... fmtn

Effect

The selected line takes the output format specified in fmt1, fmt2 ... . For information about permitted format specifications, see FORMAT.

Example

DATA I TYPE I VALUE 2.

WRITE: / 'Intensified'     INTENSIFIED,
         'Input'           INPUT,
         'color 1'         COLOR 1,
         'intensified off' INTENSIFIED OFF.

* Line selection
AT LINE-SELECTION.
  MODIFY CURRENT LINE
    LINE FORMAT INVERSE
                INPUT OFF
                COLOR = I.

Once you have selected the output list line (double-click), the whole line is set to COLOR 2 and INVERSE; all INPUT fields are set to INPUT OFF . The attributes INTENSIFIED and INTENSIFIED OFF do not change, because the example does not address this attribute.

Addition 3

... FIELD FORMAT f1 fmt11 ... fmt1m                   ... fn fmtn1 ... fmtnm

Effect

The output format of the field f1 is changed to the format specified in fmt11 ... fmt1m.
For details of permitted format specifications, see FORMAT. Fields occurring more than once or not at all in the line are treated as in the FIELD VALUE addition.

Note

If you combine the LINE FORMAT and FIELD FORMAT additions, the format set in LINE FORMAT is always assigned to the whole line. The individual field format specifications are applied afterwards.

Example

DATA: FLAG     VALUE 'X',
      TEXT(20) VALUE 'Australia',
       I TYPE I VALUE 7.
FORMAT INTENSIFIED OFF.
WRITE: / FLAG AS CHECKBOX, TEXT COLOR COL_NEGATIVE.

AT LINE-SELECTION.
   MODIFY CURRENT LINE
     LINE  FORMAT INTENSIFIED
     FIELD VALUE  FLAG FROM SPACE
     FIELD FORMAT FLAG INPUT OFF
                  TEXT COLOR = I.

When you choose the list line (double-click), the checkbox for FLAG is reset (FIELD VALUE addition, see above), and it is not ready for input. The format for the whole line is set to "intensive", and TEXT is displayed in a different color.

Addition 4

... LINE VALUE FROM wa

Effect

The current value of the field wa is placed in the list as the contents of a line.

Note

You can use the LINE VALUE addition to modify the whole contents of the line. Instead of placing the new line contents in the system field SY-LISEL (length: 255 characters), you place it instead in a user-defined work area wa. It is thus independent of the attributes of SY-LISEL.

If you need a work area wa that is big enough for any width of list, choose type SLIST_MAX_LISTLINE from type group SLIST.

Addition 5

... FIELD VALUE f1 FROM g1 ... fn FROM gn

Effect

The contents of the fields f1, f2, ... are overwritten in the list line with the current contents of fields g1, g2, ... (type conversion as with MOVE of g1, g2, ... to type C). The field contents of f1, f2, ... themseleves remain unchanged by the overwrite.

Notes

Example

INCLUDE <ICON>.
DATA NEW_ICON LIKE ICON_SORT_DOWN VALUE ICON_SORT_DOWN.
. . .
WRITE ICON_SORT_UP AS ICON.
. . .
AT LINE-SELECTION.
CALL FUNCTION 'LIST_ICON_PREPARE_FOR_MODIFY'
     CHANGING
          NEW_ICON = NEW_ICON.
MODIFY CURRENT LINE FIELD VALUE ICON_SORT_UP FROM NEW_ICON.

Variant 2

MODIFY LINE n OF CURRENT PAGE.

Extras:

1. ... LINE  FORMAT fmt1 ... fmtn

2. ... FIELD FORMAT f1 fmt11 ... fmt1m ... fn fmtn1 ... fmtnm

3. ... LINE  VALUE FROM wa

4. ... FIELD VALUE f1 FROM g1 ... fn FROM gn

Effect

Changes the nth line on the page displayed (system field SY-CPAGE).

Addition 1

... LINE  FORMAT fmt1 ... fmtn

Addition 2

... FIELD FORMAT f1 fmt11 ... fmt1m
              ... fn fmtn1 ... fmtnm

Addition 3

... LINE  VALUE FROM wa

Addition 4

... FIELD VALUE f1 FROM g1 ... fn FROM gn

Effect

siehe MODIFY LINE

Variant 3

MODIFY LINE n OF PAGE m.

Extras:

1. ... LINE  FORMAT fmt1 ... fmtn 2. ... FIELD FORMAT f1 fmt11 ... fmt1m ... fn fmtn1 ... fmtnm
3. ... LINE  VALUE FROM wa
4. ... FIELD VALUE f1 FROM g1 ... fn FROM gn

Effect

Changes the nth line on page m.

Addition 1

... LINE  FORMAT fmt1 ... fmtn

Addition 2

... FIELD FORMAT f1 fmt11 ... fmt1m               ... fn fmtn1 ... fmtnm

Addition 3

... LINE  VALUE FROM wa

Addition 4

... FIELD VALUE f1 FROM g1 ... fn FROM gn

Effect

siehe MODIFY LINE

Variant 4

MODIFY CURRENT LINE.

Extras:

1. ... LINE  FORMAT fmt1 ... fmtn 2. ... FIELD FORMAT f1 fmt11 ... fmt1m ... fn fmtn1 ... fmtnm
3. ... LINE  VALUE FROM wa
4. ... FIELD VALUE f1 FROM g1 ... fn FROM gn

Effect

Changes the last line to be read using line selection or READ LINE (even if that was in a different list level). This variant is particularly useful whenever the line to be modified has definitely been chosen using line selection or READ LINE. You then do not need to note the number of lines to the MODIFY.

Addition 1

... LINE  FORMAT fmt1 ... fmtn

Addition 2

... FIELD FORMAT f1 fmt11 ... fmt1m               ... fn fmtn1 ... fmtnm

Addition 3

... LINE  VALUE FROM wa

Addition 4

... FIELD VALUE f1 FROM g1 ... fn FROM gn

Effect

see MODIFY LINE

Additional help

Modifying Lines in Lists