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

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

CLEAR

Basic form

CLEAR f.

Additions



1. ... WITH g
2. ... WITH NULL

Effect

Resets the contents of f to its initial value.

For predefined types (see DATA ), the following initial values are used:
Type C : ' ... ' (blank character) Type N : '00...0' Type D : '00000000' Type T : '000000'
Type I : 0 Type P : 0 Type F : 0.0E+00 Type X : 0
If f is a field string, each component field is reset to its initial value. If it is an internal table without a header line, the entire table is deleted together with all its entries. If, however, f is an internal table with a header line, only the sub-fields in the table header entry are reset to their initial values.

Example

DATA: TEXT(10) VALUE 'Hello', NUMBER TYPE I VALUE 12345, ROW(10) TYPE N VALUE '1234567890', BEGIN OF PLAYER, NAME(10) VALUE 'John', TEL(8) TYPE N VALUE '08154711', MONEY TYPE P VALUE 30000, END OF PLAYER. ... CLEAR: TEXT, NUMBER, PLAYER.

The field contents are now as follows:

ROW = '1234567890'
TEXT = ' '
NUMBER = 0
PLAYER-NAME = ' '
PLAYER-TEL = '00000000'
PLAYER-MONEY = 0

Notes

When CLEAR references an internal table itab with a header line, it only resets the sub-fields in the header entry to their initial values (as mentioned above). The individual table entries remain unchanged.
To delete the entire internal table together with all its entries, you can use CLEAR itab[] or REFRESH itab . Here, a Note is still required to explain how to manipulate tables with/without header lines.
Within a logical expression , you can use f IS INITIAL to check that the field f contains the initial value appropriate for its type.
Variables are normally initialized according to their type, even if the specification of an explicit initial value (addition " ... VALUE lit " of the DATA statement) is missing. For this reason, it is not necessary to initialize variables again with CLEAR after defining them.

Addition 1

... WITH g

Effect

The field f is filled with the value of the first byte of the field g .

Addition 2

... WITH NULL

Effect

Fills the field with hexadecimal zeros.

Note

You should use this addition with particular care because the fields of most data types thus receive values which are really invalid.

Note

Performance
CLEAR requires about 3 msn (standardized microseconds) of runtime to process a field of type C with a length of 10 and about 2 msn to process a field of the type I. To delete an internal table with 15 fields, it needs about 5 msn.

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