Skip to Content
author's profile photo Former Member
Former Member

hi

what is difference between opensql and native sql

Add a comment
10|10000 characters needed characters exceeded

Related questions

3 Answers

  • Posted on Nov 29, 2007 at 05:13 PM

    OpenSQL is part of the ABAP programming language, and is like SQL. SQL is a (group of) programming languages(s) for accessing database.

    matt

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Nov 29, 2007 at 06:50 PM

    Open SQL allows you to access all database tables known to the SAP system, regardless of the database manufacturer. Sometimes, however, we may want to use database-specific SQL statements called Native SQL in your ABAP/4 program.

    To avoid incompatibilities between different database tables and also to make ABAP/4 programs independent of the database system in use, SAP has created a set of separate SQL statements called Open SQL. Open SQL contains a subset of standard SQL statements as well as some enhancements which are specific to SAP.

    A database interface translates SAP's Open SQL statements into SQL commands specific to the database in use. Native SQL statements access the database directly

    Regards,

    Maha

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Nov 30, 2007 at 07:31 AM

    Hi

    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.

    Open SQL allows you to access database tables declared in the ABAP Dictionary, regardless of the database platform you are 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 managed by the ABAP Dictionary, and therefore integrate data that is not part of the SAP Web AS ABAP 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 Anweisung

    ENDEXEC.

    e.g.

    REPORT demo_native_sql.

    DATA: BEGIN OF wa,

    connid TYPE spfli-connid,

    cityfrom TYPE spfli-cityfrom,

    cityto TYPE spfli-cityto,

    END OF wa.

    DATA c1 TYPE spfli-carrid VALUE 'LH'.

    EXEC SQL PERFORMING loop_output.

    SELECT connid, cityfrom, cityto

    INTO :wa

    FROM spfli

    WHERE carrid = :c1

    ENDEXEC.

    FORM loop_output.

    WRITE: / wa-connid, wa-cityfrom, wa-cityto.

    ENDFORM.

    The Open SQL statement for reading data from database tables is:

    SELECT result

    INTO target

    FROM source

    [WHERE condition]

    [GROUP BY fields]

    [HAVING cond]

    [ORDER BY fields].

    Please go through the link:

    http://help.sap.com/saphelp_nw2004s/helpdata/en/fc/eb3b8b358411d1829f0000e829fbfe/frameset.htm

    http://help.sap.com/saphelp_nw2004s/helpdata/en/fc/eb3b8b358411d1829f0000e829fbfe/frameset.htm

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.