IBM Global Services
ABAP Native SQL
ABAP Native SQL | 3.11 March-2005 © 2005 IBM Corporation
IBM Global Services
Objectives
The participants will be able to:
Use Native SQL in ABAP Program and Create a table.
Use Native SQL in ABAP Program to Insert into a table.
Use Native SQL in ABAP Program to select from a table.
Using PERFORMING when using Exec SQL.
2 ABAP Native SQL | 3.11 March-2005 © 2005 IBM Corporation
IBM Global Services
Using ABAP Native SQL
EXEC SQL.
<any SQL statement>
ENDEXEC.
In this example, the program
creates a table in the Oracle
database, which is not known
to the ABAP Dictionary.
The newly created database
table is populated using an
SQL INSERT statement.
3 ABAP Native SQL | 3.11 March-2005 © 2005 IBM Corporation
IBM Global Services
SELECT Using ABAP Native SQL
Data retrieved using the
SELECT statement is
transported to the
ABAP program using
Host variables
These are host variables
A Host Variable is any data
item that is defined by the
ABAP program and used
inside an ABAP Native SQL
Statement. They must be
preceded by a colon.
4 ABAP Native SQL | 3.11 March-2005 © 2005 IBM Corporation
IBM Global Services
ABAP Native SQL and the PERFORMING Option
The PERFORMING <form>
option creates a looping
structure that for every
row retrieved, the subroutine is
called.
5 ABAP Native SQL | 3.11 March-2005 © 2005 IBM Corporation
IBM Global Services
Demonstration
Creation of a program and writing ABAP native SQL.
6 ABAP Native SQL | 3.11 March-2005 © 2005 IBM Corporation
IBM Global Services
Practice
Creation of a program and writing ABAP native SQL.
7 ABAP Native SQL | 3.11 March-2005 © 2005 IBM Corporation
IBM Global Services
Summary
Database tables in ABAP Native SQL does not have to be in the ABAP
Dictionary.
The TABLES statement is not required for any tables addressed through ABAP
Native SQL.
Native SQL should be used to access data in tables outside of the SAP system.
ABAP Native SQL statements must be enclosed between EXEC SQL and
ENDEXEC.
All variables defined inside the ABAP program using a DATA or PARAMETER
statement and used inside an ABAP Native SQL statement, must be preceded by
a colon.
8 ABAP Native SQL | 3.11 March-2005 © 2005 IBM Corporation
IBM Global Services
Questions
What is native SQL?
What is the difference between a native SQL and open SQL?
Is the TABLES statement required for any table addressed through ABAP Native
SQL ?
9 ABAP Native SQL | 3.11 March-2005 © 2005 IBM Corporation