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

Netive SQL is not working

Former Member
0 Likes
987

Hi SDNers,

wen i use netive sql statements in my code, program is getting terminated and giving dump.

Can any one tell me what could be the problem.

Thansk in advance,

Renu

6 REPLIES 6
Read only

Former Member
0 Likes
958

Hi,

With the information what you have given, we cannot help you to solve your issue.

Please paste the code where you are getting the dump. So that we can help you out.

Regards,

Venkatesh

Read only

0 Likes
958

Venkatesh,

Here is the standard example i m trying to execute,


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.

I m getting below dump error

Short text

Table does not exist in database.

What happened?

The table or view name used does not

exist in the database.

The error occurred in the current database connection "DEFAULT".

Error analysis

An exception occurred that is explained in detail below.

The exception, which is assigned to class 'CX_SY_NATIVE_SQL_ERROR', was not

caught and

therefore caused a runtime error.

The reason for the exception is:

Triggering SQL statement: "SELECT connid, cityfrom, cityto FROM spfli WHERE

carrid = ? "

Database error code: "208"

Missing Handling of System Exception

Program DEMO_NATIVE_SQL

Trigger Location of Exception

Program DEMO_NATIVE_SQL

Include DEMO_NATIVE_SQL

Row 12

Module Name START-OF-SELECTION

Source Code Extract

Line SourceCde

1 REPORT demo_native_sql .

2

3 DATA: BEGIN OF wa,

4 connid TYPE spfli-connid,

5 cityfrom TYPE spfli-cityfrom,

6 cityto TYPE spfli-cityto,

7 END OF wa.

8

9 DATA c1 TYPE spfli-carrid VALUE 'LH'.

10

11 EXEC SQL PERFORMING loop_output.

>>>>> SELECT connid, cityfrom, cityto

13 INTO :wa

14 FROM spfli

15 WHERE carrid = :c1

16 ENDEXEC.

17

18 FORM loop_output.

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

20 ENDFORM.

Here i have table entry in se11.

Read only

0 Likes
958

You code Working perfect in my System. may be dumb Question whether Table spfli Exists in database?

Read only

0 Likes
958

Hi Shital,

My table is available and data also available in the table.

I knw dat the standard one will work, but might b some patches r smetihng might b missed in my server.

but i donno wer exactly the problem cmoes frm. Eagerly looking for solution for this problem.

Kindly update me on the same.

Thanks in advance,

Renu

Read only

0 Likes
958

Hi Renu,

I tried to execute the Codes you provided.It seems to work good.May be there are some patch issues

better you consult with your BASIS Consultant.They would be in better position to help you.

Regards,

Gurpreet

Read only

0 Likes
958

i have some other server, wer i can able to execute this code.

but i couldnt able to connect to external system(created system in dbco).

do i need any permissions from sap side?..

regards,

Renu