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

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

FROM clause

Variants

1. ... FROM dbtab
2. ... FROM (dbtabname)

Effect

When used in a SELECT statement, specifies the source (database table or view ) from which data can be selected.

Variant 1

... FROM dbtab

Additions



1. ... CLIENT SPECIFIED
2. ... BYPASSING BUFFER
3. ... UP TO n ROWS

Effect

Specifies the name of the database table dbtab in the program. The database table must be known to the ABAP/4 Dictionary and the program must contain an appropriate TABLES statement.

Example

Output a list of all customers:
TABLES SCUSTOM. SELECT * FROM SCUSTOM. WRITE: / SCUSTOM-ID, SCUSTOM-NAME. ENDSELECT.

Addition 1

... CLIENT SPECIFIED

Effect

Switches off automatic client handling. With client-specific tables, this enables you to read data across all clients. The client field is treated like a normal table field for which conditions can be formulated in the WHERE clause .

The addition CLIENT SPECIFIED must appear immediately after the name of the database table.

Example

Output a list of all customers in client 3:
TABLES SCUSTOM. SELECT * FROM SCUSTOM CLIENT SPECIFIED WHERE MANDT = '003'. WRITE: / SCUSTOM-ID, SCUSTOM-NAME. ENDSELECT.

Addition 2

... BYPASSING BUFFER

Effect

Reads the data records directly from the database, even if the table is in the SAP buffer .

Example

Output address of aircraft manufacturer Boeing:
TABLES SPROD. SELECT * FROM SPROD BYPASSING BUFFER WHERE PRODUCER = 'BOE'. WRITE: / SPROD-STREET, SPROD-NAME, SPROD-POSTCODE, SPROD-CITY, SPROD-COUNTRY. ENDSELECT.

Addition 3

... UP TO n ROWS

Effect

Restricts the result set to a maximum of n lines.

Example

Output a list of the 3 business customers with the highest discounts:
TABLES SCUSTOM. SELECT * FROM SCUSTOM UP TO 3 ROWS WHERE CUSTTYPE = 'B'. ORDER BY DISCOUNT DESCENDING. WRITE: / SCUSTOM-ID, SCUSTOM-NAME, SCUSTOM-DISCOUNT. ENDSELECT.

Notes

If you combine UP TO n ROWS with an ORDER-BY clause , the records are arranged in the specified order and the first n records are output. To achieve this, you must sometimes read more than n records in the database.
If n = 0, all the selected records are returned.
If n < 0, a runtime error occurs.

Variant 2

... FROM (dbtabname)

Additions



1. ... CLIENT SPECIFIED
2. ... BYPASSING BUFFER
3. ... UP TO n ROWS

Effect

Specifies the name of the database table as the contents of the field dbtabname at runtime. The database table must be known to the ABAP/4 Dictionary .

Example

Output a list of all customers:
DATA TABNAME(10). DATA: BEGIN OF WA, ID LIKE SCUSTOM-ID, NAME LIKE SCUSTOM-NAME, REST(100), END OF WA. TABNAME = 'SCUSTOM'. SELECT * INTO WA FROM (TABNAME). WRITE: / WA-ID, WA-NAME. ENDSELECT.

Notes

If you use an INTO clause , you can only specify the name of the database table at runtime.
The database table name must always be in upper case.

Addition 1

... CLIENT SPECIFIED

Effect

As for variant 1.

Addition 2

... BYPASSING BUFFER

Effect

As for variant 1.

Addition 3

... UP TO n ROWS

Effect

As for variant 1.

Note

Performance
With small datasets, you should always try to avoid specifying the name of the database table at runtime because this adversely affects performance. With larger datasets, there is no such problem.

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