Difference between Open SQL and Native SQL

by | Apr 8, 2022 | ABAP, ABAP Beginner, Oracle, SAP, SQL

Preface – This post is part of the ABAP Beginner series.

Introduction

There are two forms of SQL used in the ABAP/4 programming language:

OPEN SQL and NATIVE SQL

Regardless of the database platform used by the R/3 system, Open SQL allows you to access the database tables stated in the ABAP dictionary.

In an ABAP/4 programme, native SQL allows you to use database-specific SQL statements. This means you can use database tables that aren’t managed by the ABAP dictionary and incorporate data from outside the R/3 system.

Open SQL is a set of ABAP statements that conduct operations on the R/3 system’s core database. The operations’ results and any error messages are unaffected by the database system in use.

What is Open SQL

Open SQL allows programmers to directly manipulate SQL statements. In native SQL, there is no requirement for a period after the statement. It also deviates from ABAP best practices. The Open SQL operations correspond to the primitive operations given by each database, although the API is uniform across all vendors.

What is Native SQL

In an ABAP programme, native SQL allows you to use database-specific SQL statements. This implies you can use database tables that aren’t managed by the ABAP Dictionary, and so incorporate data from sources other than the R/3 System.

In an ABAP programme, you can use ABAP Native SQL to add database-specific SQL statements. Most ABAP programmes with database-specific SQL queries don’t work with other databases. Use Open SQL if many databases are involved. Use the EXEC statement in an ABAP programme to execute ABAP Native SQL. You can use Open SQL (a subset of conventional SQL statements) to access all database tables in the R/3 System, regardless of the manufacturer.

Difference between  Open SQL vs Native SQL

Open SQLNative SQL
Open SQL allows programmers to directly manipulate SQL statements.In an ABAP programme, native SQL allows you to use database-specific SQL statements.
It implements and executes the code at the application server levelIt implements and executes the code at the database level
Access to tables from other systems is not possible.Access to tables from other systems is possible.
Data from several database platforms can be accessed with OpenSQL.Data from different database platforms are not allowed in native SQL.
Between the EXEC and END-EXEC statements, a syntax check is performed.There is no check for syntax.
A period (.) is required after each open SQL statement, just like it is required after each ABAP statement.There is no need for a period following the statement in native SQL. It also deviates from standard ABAP conventions.

 

Author

0 Comments

Submit a Comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.