‎2007 Apr 04 12:15 PM
‎2007 Apr 04 12:22 PM
Hi..
2 Types:-
1, Open SQL
2, native SQL.
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 useful answers.
Regards
Bala.
‎2007 Apr 04 12:22 PM
Hi..
2 Types:-
1, Open SQL
2, native SQL.
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 useful answers.
Regards
Bala.
‎2007 Apr 04 12:31 PM
hi Jeya,
Different SQL statements used in ABAP are
(1) Open SQL
(2) Native SQL
Open SQL consists of a set of ABAP statements that perform operation on the central database in R/3 System. Open SQL provides a uniform syntax and semantics for all the database systems supported by SAP.
Native SQL is SQL for database in use. Besides OPEN SQL, if you need you can use the native SQL for databases.But an ABAP program containing database-specific SQL statements, i.e., native sql statements, it will not run under different database systems. If your program is to be used on more than one database platform, then use only Open SQL statements.
Reward if found useful
Regards
Sayee
‎2007 Apr 09 9:37 AM
‎2007 Apr 09 11:58 AM
SQL Statements
1)
ENDEXEC.There is no period after Native SQL statements. Also, using quotation marks (") or an asterisk (*) at the beginning of a native SQL statement's line does not introduce a comment as it would in normal ABAP syntax. You need to know if the table and field names are case-sensitive in your chosen database.
The data is transported between the database table and the ABAP program using host variables in Native SQL statements. These are preceded in a Native SQL statement by a colon ( and are declared in the ABAP program. The elementary structures can be used as host variables. The structures of an INTO clause are treated exceptionally, as though all of their fields are listed individually. If the selection in a Native SQL SELECT statement is a table, then you can pass it to ABAP line by line using the PERFORMING addition. For each line read, the program calls a subroutine
‎2007 Apr 09 12:58 PM
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.
ABAP program containing database-specific SQL statements( Native SQL) will not run under different database systems. If your program will be used on more than one database platform, only use Open SQL statements.
Regards
Jayan Chembadathil.
‎2007 Apr 09 1:24 PM
he <u><b>Structured Query Language (SQL)</b></u> is a largely standardized language, which is used for accessing relational databases. It can be divided as follows:
<b>
Data Manipulation Language (DML)</b>
These statements are for reading and changing data in database tables.
<b>Data Definition Language (DDL)</b>
These statements are for creating and administering database tables.
<b>
Data Control Language (DCL)</b>
These statements are used for authorization and consistency checks.
<b>
Open SQL</b> are statements that make up a subset of Standard SQL which is fully integrated in ABAP. Open SQL consists of Data Manipulation Language (DML) which is a part of Standard SQL.
Some Open SQL keywords are as follows:
<b>SELECT </b>- It reads data from database tables.
<b>INSERT</b> - It adds rows to database tables.
<b>UPDATE</b> - It changes the contents of rows of database tables.
<b>
MODIFY</b> - It inserts rows into database tables or changes the content of existing rows.
<b>DELETE</b> - It deletes rows from database tables.
<b>OPEN CURSOR, FETCH, CLOSE CURSOR</b> - It reads rows of database tables using the cursor.
Return Codes
The following two system fields are filled with return codes by all Open SQL statements:
<b>SY-SUBRC:</b> The system field SY -SUBRC contains the value 0 after every Open SQL statement if the operation was successful. When a value is other than 0, then it is unsuccessful.
<b>SY-DBCNT:</b> The system field SY-DBCNT contains the number of database lines processed after an open SQL statement.
<u><b>Native SQL Scope</b></u>
Native SQL is very important as it allows you to execute nearly all available statements through the SQL programming interface (usually known as SQL Call Interface or similar) for directly executing SQL program code (using EXEC IMMEDIATE or a similar command).