0% found this document useful (0 votes)
54 views

Chapter 11 - ABAP Native SQL

This document discusses using ABAP Native SQL in ABAP programs. It explains that Native SQL allows accessing tables outside of the SAP system and does not require tables to be defined in the ABAP Dictionary. The document demonstrates how to create and populate tables using Native SQL statements enclosed between EXEC SQL and ENDEXEC, and how host variables transport data between SQL and the ABAP program. It also covers using the PERFORMING option to call a subroutine for each row retrieved by a SELECT statement.

Uploaded by

Mostafa Hassanin
Copyright
© © All Rights Reserved
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
54 views

Chapter 11 - ABAP Native SQL

This document discusses using ABAP Native SQL in ABAP programs. It explains that Native SQL allows accessing tables outside of the SAP system and does not require tables to be defined in the ABAP Dictionary. The document demonstrates how to create and populate tables using Native SQL statements enclosed between EXEC SQL and ENDEXEC, and how host variables transport data between SQL and the ABAP program. It also covers using the PERFORMING option to call a subroutine for each row retrieved by a SELECT statement.

Uploaded by

Mostafa Hassanin
Copyright
© © All Rights Reserved
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
You are on page 1/ 9

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

You might also like