Native SQL

Native SQL statements allow you to access the data directly from the Database. The developer can directly write database specific SQL statements in the ABAP program using the keyword EXEC SQL … ENDEXEC.

Here is how the actual syntax goes.

EXEC SQL [PERFORMING <form>].
Native SQL Statements
ENDEXEC.

Here is the actual example:

EXEC SQL PERFORMING loop_output.
SELECT connid, cityfrom, cityto
INTO :wa
FROM spfli
WHERE carrid = :c1
ENDEXEC.

FORM loop_output.
WRITE: / wa-connid, wa-cityfrom, wa-cityto.
ENDFORM.

Remember there is no period(.) in the end of the statements and you cannot use comments like (“) or (*) in inside the native SQL statements.

Comments