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

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

EXEC

Basic form

EXEC SQL.

Addition



... PERFORMING form

Effect

Executes the Native SQL command enclosed by the statements EXEC SQL and ENDEXEC . In contrast to Open SQL , addressed database tables do not have to be known to the ABAP/4 Dictionary and the ABAP/4 program does not have to contain appropriate TABLES statements.

Example

Create the table AVERI_CLNT :
EXEC SQL. CREATE TABLE AVERI_CLNT ( CLIENT CHAR(3) NOT NULL, ARG1 CHAR(3) NOT NULL, ARG2 CHAR(3) NOT NULL, FUNCTION CHAR(10) NOT NULL, PRIMARY KEY (CLIENT, ARG1, ARG2) ) ENDEXEC.

With Native SQL commands, passing data between an ABAP/4 program and the database is achieved using host variables . A host variable is an ABAP/4 variable prefixed by a "*" in the Native SQL statement.

Example

Display a section of the table AVERI_CLNT :
DATA: F1(3), F2(3), F3(3). F3 = ' 1 ' EXEC SQL. SELECT CLIENT, ARG1 INTO :F1, :F2 FROM AVERI_CLNT WHERE ARG2 = :F3 ENDEXEC. WRITE: / F1, F2.

To simplify the spelling of INTO lists in the SELECT command, you can specify a single structure as the target area as in Open SQL .

Example

Display a section of the table AVERI_CLNT :
DATA: BEGIN OF WA, CLIENT(3), ARG1(3), ARG2(3), END OF WA. DATA F3(3). F3 = ' 1 ' EXEC SQL. SELECT CLIENT, ARG1 INTO :WA FROM AVERI_CLNT WHERE ARG2 = :F3 ENDEXEC. WRITE: / WA-CLIENT, WA-ARG1.

Notes

In contrast to Open SQL , a client field in Native SQL is a field like any other and must be specified explicitly in calls.
Authorization checks cannot be properly realized in EXEC SQL . You should perform these in the program.
When you start the R/3 System, a CONNECT to the current database is executed automatically. An explicit CONNECT is unnecessary.
A Native SQL command can (but does not have to) end with a ";". Under no circumstances should it end with a ".".
Some database systems allow upper and lower case in table names and field names. If you want to take advantage of this, you must ensure that the spelling of names is correct. To enable entry of lower case letters in names in the ABAP/4 editor, you must set the attribute for upper/lower case in the report.
Since there are no arrays in ABAP/4 , array operations are not possible in Native SQL . If the result of a SELECT command is a table, you can read this table line by line either with the Native SQL command FETCH or with the addition ... PERFORMING form .
Unlike in ABAP/4 programs, the character " in a Native SQL statement does not introduce a comment until the end of the editor line.

Addition

... PERFORMING form

Effect

If the result of a SELECT command is a table, you can read this table line by line in a processing loop. The subroutine form is called once for each line. In this subroutine, you can leave the loop by using EXIT FROM SQL . If the result of the selection is a single record, the subroutine is called only once.

Example

Display a section of the table AVERI_CLNT :
DATA: F1(3), F2(3), F3(3). F3 = ' 1 ' EXEC SQL PERFORMING WRITE_AVERI_CLNT. SELECT CLIENT, ARG1 INTO :F1, :F2 FROM AVERI_CLNT WHERE ARG2 = :F3 ENDEXEC. FORM WRITE_AVERI_CLNT. WRITE: / F1, F2. ENDFORM.

Note

This addition is allowed only with a SELECT command.
Related SELECT , INSERT , UPDATE , MODIFY , DELETE , OPEN CURSOR , FETCH , CLOSE CURSOR, COMMIT WORK and ROLLBACK WORK .

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