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

Native SQL

Dear All,

Im trying to get a feild called 'DO' from table 'partinfo' from native SQL .

EXEC SQL .

SELECT LOTID, EQPID, DO

INTO :ITAB1

FROM partinfo

WHERE LOTID = '12345'

ENDEXEC.

But SAP is throwing this error.

Database error text........: "ORA-00904: "DO": invalid identifier"

I tried without 'Do', It is working Fine.

I cant change the Table or its feild, Bcos other teams also using this table.

Thanks & regards,

Chakri.

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

4 Answers

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Jan 30, 2008 at 07:19 AM

    Hi,

    Try [DO] when selecting it for example: SELECT [DO] FROM.

    Cheers,

    Chaitanya.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jan 29, 2008 at 01:47 PM
    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jan 29, 2008 at 01:57 PM

    Hi

    Hope it will help you.

    <REMOVED BY MODERATOR>

    Native SQL statements define an area in an ABAP program in which one or more Native SQL statements are to be carried out. The area between EXEC and ENDEXEC is not completely checked by the syntax check. The statements entered there are passed to the Native SQL interface and processed there as follows:

    Almost all SQL statements that are valid for the addressed database system can be included between EXEC and ENDEXEC, in particular the DDL statements. These SQL statements are passed from the Native SQL interface to the database system largely unchanged. The syntax rules are specified by the database system, in particular the case sensitivity rules for database objects. If the syntax allows a separator character between individual statements, you can include several Native SQL statements between EXEC and ENDEXEC. Generally, the semicolon (😉 is used as the separator character.

    You can also include SAP-specific Native SQL language elements between EXEC and ENDEXEC. These statements are not passed directly from the Native SQL interface to the database, but are converted appropriately.

    All Native SQL statements bypass SAP buffering.

    The ENDEXEC statement sets sy-dbcnt to the number of table rows processed in the last Native SQL statement. After implicit cursor processing with PERFORMING, sy-dbcnt contains the total number of lines read.

    Programs with Native SQL statements are generally dependent on the database system used, so that they cannot be executed in all ABAP systems. This is especially true for the examples in this section, which was written for Informix database systems.

    Example

    Inserting two rows in the database table SCARR. If neither of these rows exists, sy-subrc is set to 0 by ENDEXEC and sy-dbcnt to 1. Otherwise, an exception is raised and handled.

    DATA: exc_ref TYPE REF TO cx_sy_native_sql_error,

    error_text TYPE string.

    TRY.

    EXEC SQL.

    INSERT INTO scarr

    (MANDT, CARRID, CARRNAME, CURRCODE, URL)

    VALUES ('000', 'FF', 'Funny Flyers', 'EUR',

    'http://www.ff.com');

    INSERT INTO scarr

    (MANDT, CARRID, CARRNAME, CURRCODE, URL)

    VALUES ('000', 'EF', 'Easy Flyers', 'EUR',

    'http://www.ef.com');

    ENDEXEC.

    CATCH cx_sy_native_sql_error INTO exc_ref.

    error_text = exc_ref->get_text( ).

    MESSAGE error_text TYPE 'I'.

    ENDTRY.

    Edited by: Alvaro Tejada Galindo on Jan 29, 2008 12:18 PM

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jan 29, 2008 at 02:44 PM

    Maby D0 instead of DO.

    Rob

    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.