Basic form
Addition: See ON CHANGE OF ... ENDON not
allowed. Effect Note Example Effect Example
... OR f1
Normally, you use the statement to manipulate database fields during
GET events or SELECT/ENDSELECT processing.
ON CHANGE OF is unsuitable for recognizing control levels in loops of
this type because it always creates a global auxiliary field which is used to
check for changes. This global auxiliary field is only changed in the relevant
ON CHANGE OF statement. It is not reset when the processing enters
loops or subroutines, so unwanted effects can occur if the loop or subroutine
is executed again. Also, since it is set to its initial value when created
(like any other field), any ON CHANGE OF processing will be executed
after the first test, unless the contents of the field concerned happen to be
identical to the initial value.
TABLES T100.
SELECT * FROM T100 WHERE SPRSL = SY-LANGU AND
MSGNR < '010'
ORDER BY PRIMARY KEY.
ON CHANGE OF T100-ARBGB.
ULINE.
WRITE: / '***', T100-ARBGB, '***'.
ENDON.
WRITE: / T100-MSGNR, T100-TEXT.
ENDSELECT.
Each time the message class changes, it is output.
You can use this addition several times.
* Logical database F1S
TABLES: SPFLI, SFLIGHT, SBOOK.
GET SBOOK.
ON CHANGE OF SPFLI-CARRID OR
SPFLI-CONNID OR
SFLIGHT-FLDATE.
ULINE.
WRITE: /5 SPFLI-CARRID, SPFLI-CONNID,
5 SFLIGHT-FLDATE, SPFLI-FLTIME,
5 SFLIGHT-SEATSMAX, SFLIGHT-SEATSOCC.
ENDON.
WRITE: / SBOOK-CUSTOMID.