SAP Database

Native SQL

Print This Post Email This Post Written by admin on Jul 30th, 2008 | Filed under: ABAP

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.

If you like this post, you may as well like these too:

  1. EXEC : ABAP Keyword a day EXEC Basic form EXEC SQL. Addition ... PERFORMING form Effect In contrast to Open SQL , addressed database tables do not have to be known to the ABAP/4 Dictionary...
  2. EXIT : ABAP Keyword a day EXIT Basic forms 1. EXIT. 2. EXIT FROM STEP-LOOP. 3. EXIT FROM SQL. EXIT in loops and modularization units Basic form EXIT. Effect * In loop structures: Leaves the loop...
  3. DEFINE : ABAP Keyword a day DEFINEBasic formDEFINE macro.EffectDefines a program component (macro) under the name macro . It must consist only of ABAP/4 statements and is expanded at compilation time.A macro should always be concluded...
  4. CASE: ABAP Keyword a day CASEBasic formCASE f.Effect Case distinction.Depending on the current contents of a field, this statement executes one of several alternative processing branches. The field whose contents determine how the subsequent processing...
  5. ABAP Programs: Using static variables REPORT ZSOURCE1003.* Calling a form twicePERFORM COUNT.PERFORM COUNT.* Defining a form with a static variableFORM COUNT. STATICS CALLS TYPE I. CALLS = CALLS + 1. WRITE CALLS.ENDFORM.~~~~~ end of post...



Leave a Reply

  • Help Support CRY