ON
CHANGE OF is executed while the associated data object is initial.
Latest notes: :This control structure is particularly prone to errors and
should be replaced by branches with
explicitly declared auxiliary variables.
Example ABAP Coding :In a SELECT loop, a statement block should only
be executed if the content of the column CARRID has changed.
DATA spfli_wa TYPE spfli.
SELECT *
FROM spfli
INTO spfli_wa
ORDER BY carrid.
...
ON CHANGE OF spfli_wa-carrid.
...
ENDON.
...
ENDSELECT.
The following section of a program shows how the ON control
structure can be replaced by an IF control structure with an
explicit auxiliary variable carrid_buffer .
DATA: spfli_wa TYPE spfli,
carrid_buffer TYPE spfli-carrid.
CLEAR carrid_buffer.
SELECT *
FROM spfli
INTO spfli_wa
ORDER BY carrid.
...
IF spfli_wa-carrid <(><<)>> carrid_buffer.
carrid_buffer = spfli_wa-carrid.
...
ENDIF.
...
ENDSELECT.
Documentation extract taken from SAP system, � Copyright SAP AG. All rights reserved