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

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

SPLIT

Variants

1. SPLIT f AT g INTO h1 ... hn.
2. SPLIT f AT g INTO TABLE itab.

Variant 1

SPLIT f AT g INTO h1 ... hn.

Effect

Splits the contents of the f according to the delimiter g and places them in the fields h1 to hn ( n >= 2).
g is used in its defined length.

The return code value is set as follows:


SY-SUBRC = 0 All hi fields (1 <= i <= n ) were big enough.
SY_SUBRC = 4 One of the hi fields was not big enough and had to be truncated.

Examples

DATA: NAMES(30) VALUE 'Charly, John, Peter', ONE(10), TWO(10), DELIMITER(2) VALUE ','. SPLIT NAMES AT DELIMITER INTO ONE TWO.

Now, ONE has the value "Charly" and TWO has the value "John, Pete" .
SY-SUBRC is set to 4, since TWO was not big enough to include "John, Peter" .
DATA: NAMES2(30) VALUE 'Charly, John, Peter', THREE(10) VALUE 'New York', FOUR(10), FIVE(10), SIX(10) VALUE 'SAP'. SPLIT NAMES2 AT ',' INTO THREE FOUR FIVE SIX. IF THREE = 'Charly' AND FOUR = ' John' AND FIVE = ' Peter' AND SIX = SPACE. WRITE 'SPLIT is OK'. ENDIF.

Outputs "SPLIT is OK" .

Note


Variant 2

SPLIT f AT g INTO TABLE itab.

Effect

Like variant 1.

Stores the components of f in the internal table itab . For each part of f , a "special" table line is created.
f is considered without trailing blanks.

Example

DATA: BEGIN OF ITAB OCCURS 10, WORD(20), END OF ITAB. SPLIT 'STOP Two STOP Three STOP ' AT 'STOP' INTO TABLE ITAB.

Now, ITAB has three lines. The first line is blank, the second contains 'Two' and the third contains 'Three' .

Note

Performance
The runtime required for the SPLIT command in the first example for variant 1 is about 15 msn (standardized microseconds). If the sub-fields of f are written to an internal table, about 30 msn are needed.
Related CONCATENATE , SEARCH , SHIFT

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