Chapter 11_ABAP Native SQL

download Chapter 11_ABAP Native SQL

of 9

Transcript of Chapter 11_ABAP Native SQL

  • 7/27/2019 Chapter 11_ABAP Native SQL

    1/9

    IBM Global Services

    2005 IBM CorporationABAP Native SQL | Dec-2008

    ABAP Native SQL

  • 7/27/2019 Chapter 11_ABAP Native SQL

    2/9

    IBM Global Services

    2005 IBM Corporation2 Dec-2008ABAP Native SQL |

    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.

  • 7/27/2019 Chapter 11_ABAP Native SQL

    3/9

    IBM Global Services

    2005 IBM Corporation3 Dec-2008ABAP Native SQL |

    Using ABAP Native SQL

    EXEC SQL.

    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.

  • 7/27/2019 Chapter 11_ABAP Native SQL

    4/9

    IBM Global Services

    2005 IBM Corporation4 Dec-2008ABAP Native SQL |

    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 theABAP program and used

    inside an ABAP Native SQL

    Statement. They must be

    preceded by a colon.

  • 7/27/2019 Chapter 11_ABAP Native SQL

    5/9

    IBM Global Services

    2005 IBM Corporation5 Dec-2008ABAP Native SQL |

    ABAP Native SQL and the PERFORMING Option

    The PERFORMING

    option creates a looping

    structure that for every

    row retrieved, the subroutine

    is called.

  • 7/27/2019 Chapter 11_ABAP Native SQL

    6/9

    IBM Global Services

    2005 IBM Corporation6 Dec-2008ABAP Native SQL |

    Demonstration

    Creation of a program and writing ABAP native SQL.

  • 7/27/2019 Chapter 11_ABAP Native SQL

    7/9

    IBM Global Services

    2005 IBM Corporation7 Dec-2008ABAP Native SQL |

    Practice

    Creation of a program and writing ABAP native SQL.

  • 7/27/2019 Chapter 11_ABAP Native SQL

    8/9

    IBM Global Services

    2005 IBM Corporation8 Dec-2008ABAP Native SQL |

    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.

  • 7/27/2019 Chapter 11_ABAP Native SQL

    9/9

    IBM Global Services

    2005 IBM Corporation9 Dec-2008ABAP Native SQL |

    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 ?