Chapter 11_ABAP Native SQL.ppt

download Chapter 11_ABAP Native SQL.ppt

of 9

Transcript of Chapter 11_ABAP Native SQL.ppt

  • 8/14/2019 Chapter 11_ABAP Native SQL.ppt

    1/9

    IBM Global Services

    2005 IBM Corporation ABAP Native SQL | 3.11 March-2005

    ABAP Native SQL

  • 8/14/2019 Chapter 11_ABAP Native SQL.ppt

    2/9

    IBM Global Services

    2005 IBM Corporation2 March-2005 ABAP Native SQL | 3.11

    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.

  • 8/14/2019 Chapter 11_ABAP Native SQL.ppt

    3/9

    IBM Global Services

    2005 IBM Corporation3 March-2005 ABAP Native SQL | 3.11

    Using ABAP Native SQL

    EXEC SQL.

    ENDEXEC.

    In this example, the programcreates a table in the Oracledatabase, which is not knownto the ABAP Dictionary.

    The newly created databasetable is populated using anSQL INSERT statement.

  • 8/14/2019 Chapter 11_ABAP Native SQL.ppt

    4/9

    IBM Global Services

    2005 IBM Corporation4 March-2005 ABAP Native SQL | 3.11

    SELECT Using ABAP Native SQL

    Data retrieved using theSELECT statement is

    transported to theABAP program using

    Host variables

    These are host variables

    A Host Variable is any data

    item that is defined by theABAP program and used

    inside an ABAP Native SQLStatement. They must be

    preceded by a colon.

  • 8/14/2019 Chapter 11_ABAP Native SQL.ppt

    5/9

    IBM Global Services

    2005 IBM Corporation5 March-2005 ABAP Native SQL | 3.11

    ABAP Native SQL and the PERFORMING Option

    The PERFORMING option creates a loopingstructure that for every

    row retrieved, the subroutineis called.

  • 8/14/2019 Chapter 11_ABAP Native SQL.ppt

    6/9

    IBM Global Services

    2005 IBM Corporation6 March-2005 ABAP Native SQL | 3.11

    Demonstration

    Creation of a program and writing ABAP native SQL.

  • 8/14/2019 Chapter 11_ABAP Native SQL.ppt

    7/9

    IBM Global Services

    2005 IBM Corporation7 March-2005 ABAP Native SQL | 3.11

    Practice

    Creation of a program and writing ABAP native SQL.

  • 8/14/2019 Chapter 11_ABAP Native SQL.ppt

    8/9

    IBM Global Services

    2005 IBM Corporation8 March-2005 ABAP Native SQL | 3.11

    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 ABAPNative 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 andENDEXEC.

    All variables defined inside the ABAP program using a DATA or PARAMETERstatement and used inside an ABAP Native SQL statement, must be preceded bya colon.

  • 8/14/2019 Chapter 11_ABAP Native SQL.ppt

    9/9

    IBM Global Services

    2005 IBM Corporation9 March-2005 ABAP Native SQL | 3.11

    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 NativeSQL ?