ABAP/4   ОКМ   ДМ   экономическая информатика   4GL   Теория и практика обработки информации

Компьютерный язык ABAP/4 - ключевые слова

ON

Basic form

ON CHANGE OF f.

Addition



... OR f1

Effect

Executes the processing block enclosed by the " ON CHANGE OF f " and " ENDON " statements whenever the contents of the field f change (control break processing).

Normally, you use the statement to manipulate database fields during GET events or SELECT / ENDSELECT processing.

Note

There are special control structures for processing control breaks in LOOP s on internal tables or extract datasets AT ).

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 can only be changed in the relevant ON CHANGE OF statement. It is not reset when the processing goes into 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.

Example

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.

Displays all messages with their numbers in the logon language, provided the number is less than '010'.
Each time the message class changes, it is output.

Addition

... OR f1

Effect

Also executes the code whenever the contents of the field f1 changes.
You can use this addition several times.

Example

* 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.

The code between ON CHANGE OF and ENDON is executed only if at least one of the fields SPFLI-CARRID , SPFLI-CONNID or SFLIGHT-FLDATE has changed, i.e. there is a different flight connection (which also has bookings).

Notes

Between ON CHANGE OF and ENDON , you can use ELSE for case distinction. You can also use ELSEIF statements in conjunction with special implementation of ON , but should always try to avoid this because they may not be supported in future.
Related AT - control breaks with internal tables
AT - control breaks with extracts

Index
© SAP AG 1996
ABAP/4   ОКМ   ДМ   экономическая информатика   4GL   Теория и практика обработки информации

НОВОСТИ ФОРУМА

Форум Рыцари теории эфира


Рыцари теории эфира
 10.11.2021 - 12:37: ПЕРСОНАЛИИ - Personalias -> WHO IS WHO - КТО ЕСТЬ КТО - Карим_Хайдаров.
10.11.2021 - 12:36: СОВЕСТЬ - Conscience -> РАСЧЕЛОВЕЧИВАНИЕ ЧЕЛОВЕКА. КОМУ ЭТО НАДО? - Карим_Хайдаров.
10.11.2021 - 12:36: ВОСПИТАНИЕ, ПРОСВЕЩЕНИЕ, ОБРАЗОВАНИЕ - Upbringing, Inlightening, Education -> Просвещение от д.м.н. Александра Алексеевича Редько - Карим_Хайдаров.
10.11.2021 - 12:35: ЭКОЛОГИЯ - Ecology -> Биологическая безопасность населения - Карим_Хайдаров.
10.11.2021 - 12:34: ВОЙНА, ПОЛИТИКА И НАУКА - War, Politics and Science -> Проблема государственного терроризма - Карим_Хайдаров.
10.11.2021 - 12:34: ВОЙНА, ПОЛИТИКА И НАУКА - War, Politics and Science -> ПРАВОСУДИЯ.НЕТ - Карим_Хайдаров.
10.11.2021 - 12:34: ВОСПИТАНИЕ, ПРОСВЕЩЕНИЕ, ОБРАЗОВАНИЕ - Upbringing, Inlightening, Education -> Просвещение от Вадима Глогера, США - Карим_Хайдаров.
10.11.2021 - 09:18: НОВЫЕ ТЕХНОЛОГИИ - New Technologies -> Волновая генетика Петра Гаряева, 5G-контроль и управление - Карим_Хайдаров.
10.11.2021 - 09:18: ЭКОЛОГИЯ - Ecology -> ЭКОЛОГИЯ ДЛЯ ВСЕХ - Карим_Хайдаров.
10.11.2021 - 09:16: ЭКОЛОГИЯ - Ecology -> ПРОБЛЕМЫ МЕДИЦИНЫ - Карим_Хайдаров.
10.11.2021 - 09:15: ВОСПИТАНИЕ, ПРОСВЕЩЕНИЕ, ОБРАЗОВАНИЕ - Upbringing, Inlightening, Education -> Просвещение от Екатерины Коваленко - Карим_Хайдаров.
10.11.2021 - 09:13: ВОСПИТАНИЕ, ПРОСВЕЩЕНИЕ, ОБРАЗОВАНИЕ - Upbringing, Inlightening, Education -> Просвещение от Вильгельма Варкентина - Карим_Хайдаров.
Bourabai Research - Технологии XXI века Bourabai Research Institution