As already mentioned, Native SQL allows you to use database-specific SQL statements in an ABAP program.
To use Native SQL statement, you must precede it with the EXEC SQL statement, and follow it with the ENDEXEC statement.
Syntax
1
2
3
4
5
|
EXEC SQL [PERFORMING <form>]. <Native SQL statement> ENDEXEC. |
There is no period after Native SQL statements. Furthermore, using inverted commas (") or an asterisk (*) at the beginning of a line in a native SQL statement does not introduce a comment as it would in normal ABAP syntax. You need to know whether table and field names are case-sensitive in your chosen database.
In Native SQL statements, the data is transported between the database table and the ABAP program using host variables. These are declared in the ABAP program, and preceded in the Native SQL statement by a colon (:). You can use elementary structures as host variables. Exceptionally, structures in an INTO clause are treated as though all of their fields were listed individually.
As in Open SQL, after the ENDEXEC statement, SY-DBCNT contains the number of lines processed. In nearly all cases, SY-SUBRC contains the value 0 after the ENDEXEC statement.