Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Open & Native SQL

Former Member
0 Likes
1,267

Hai all !

Can anybody give me the exact Difference between Open SQL & Native SQL.

Thanks in Advance,

Swapna.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,224

Open SQL allows us to access database tables declared in the ABAP Dictionary regardless of the database platform that our R/3 System is using. Native SQL allows us to use database-specific SQL statements in an ABAP program. This means that we can use database tables that are not administered by the ABAP Dictionary, and therefore integrate data that is not part of the R/3 System.

Native SQL statements must be within u2018EXEC SQLu2019 and u2018ENDEXECu2019.

EXEC SQL [PERFORMING <form>].

<Native SQL statement>

ENDEXEC.

Regards,

Joy.

9 REPLIES 9
Read only

Former Member
0 Likes
1,225

Open SQL allows us to access database tables declared in the ABAP Dictionary regardless of the database platform that our R/3 System is using. Native SQL allows us to use database-specific SQL statements in an ABAP program. This means that we can use database tables that are not administered by the ABAP Dictionary, and therefore integrate data that is not part of the R/3 System.

Native SQL statements must be within u2018EXEC SQLu2019 and u2018ENDEXECu2019.

EXEC SQL [PERFORMING <form>].

<Native SQL statement>

ENDEXEC.

Regards,

Joy.

Read only

Former Member
Read only

Former Member
0 Likes
1,224

Hii!

Open SQL is basically SAP specific Structured Query language.Open SQL consists of a set of ABAP statements that perform operations on the central database in the R/3 System. The results of the operations and any error messages are independent of the database system in use. Open SQL thus provides a uniform syntax and semantics for all of the database systems supported by SAP. ABAP programs that only use Open SQL statements will work in any R/3 System, regardless of the database system in use. Open SQL statements can only work with database tables that have been created in the ABAP Dictionary.

Native SQL is basically a database specific language.

Open SQL allows you to access database tables declared in the ABAP Dictionary regardless of the database platform that you R/3 System is using. Native SQL allows you to use database-specific SQL statements in an ABAP program. This means that you can use database tables that are not administered by the ABAP Dictionary, and therefore integrate data that is not part of the R/3 System.

As a rule, an ABAP program containing database-specific SQL statements will not run under different database systems. If your program will be used on more than one database platform, only use Open SQL statements.

To use a Native SQL statement, you must precede it with the EXEC SQL statement, and follow it with the ENDEXEC statement as follows:

EXEC SQL [PERFORMING <form>].

<Native SQL statement>

ENDEXEC.

Read only

Former Member
0 Likes
1,224

hi

ABAP Native SQL allows you to include database-specific SQL statements in an ABAP program.

Most ABAP programs containing database-specific

SQL statements do not run with different databases.

If different databases are involved, use Open SQL.

To execute ABAP Native SQL in an ABAP program,

use the statement EXEC. Open SQL (Subset of standard SQL statements), allows you to access all database tables available in the R/3 System,

regardless of the manufacturer.

To avoid conflicts between database tables and to keep ABAP programs independent from the database system used, SAP has generated its own set of SQL statements known as Open SQL.

Reward points

Cheers

Snehi

Read only

Former Member
0 Likes
1,224

Native SQL is Native to that data base server

SQL structured query langauge.

if you are useing oracel.

u can write oracel commands to feach data in ur abap program.

these commends are call native SQL commands to that serve.

nativesql -


>database

open sql.

these commands can feach data from any database sever.

so there are called open sql statements.

open sql-->databse utility--->nativesql -


>database.

Read only

Former Member
0 Likes
1,224

Hello Swapna,

ABAP Native SQL allows you to include database-specific SQL statements in an ABAP program.

Most ABAP programs containing database-specific SQL statements do not run with different databases. If different databases are involved, use Open SQL.

To avoid conflicts between database tables and to keep ABAP programs independent from the database system used, SAP has generated its own set of SQL statements known as Open SQL.

Regards,

Bhumika

Read only

Former Member
0 Likes
1,224

Hi Swapna,

Native SQL is database specific, which means, it recognizes only those commands pertaining to the underlying database in SAP.

Open SQL, not being database specific convert the Open SQL commands into the underlying database commands using the database interface. In simple terms, the database interface translates the Open SQL commands into Native SQL commands.

The Native SQL commands bypass the database interface.

Reward if useful.

I.

Read only

Former Member
0 Likes
1,224

Thanks All.

Read only

JanStallkamp
Advisor
Advisor
0 Likes
1,224

Hi.

Even if you marked your question as solved I would like to mention one point: Do not use native SQL if there is not a very good reason. Of course you will need it if you want to manipulate data outside the SAP system. But by using Native SQL you loose a lot of features OpenSQL offers. Syntax checking, type checks and so on can't be provided for Native SQL in the same way. And in the case you ever want to migrate to a different database you have to rewrite the statements.

But of course there are places where Native SQL has to be used. Use it with care and it's a very powerfull tool.

Best regards,

Jan Stallkamp