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

native sql && BUT000

Former Member
0 Likes
526

In my function I am using the following code:


DATA: lv_message TYPE string.
DATA: sql_error  TYPE REF TO cx_sy_native_sql_error.
DATA: dbcursor   TYPE c.

TRY.
  EXEC SQL.
    open :dbcursor for
    SELECT partner
    FROM but000
    WHERE UPPER(name_first) LIKE :name_first
  ENDEXEC.
  CATCH cx_sy_native_sql_error INTO sql_error.
    lv_message = sql_error->get_text( ).
    MESSAGE lv_message TYPE 'E'.
ENDTRY.

This is giving the error message: "You tried to work with the name of a table or view that does not exist in the database".

Same error message occurs when I add the declaration: TABLES but000.

How can this be solved?

Kind regards,

Lieselot

3 REPLIES 3
Read only

Former Member
0 Likes
472

Hi,

this is what the documentation says:


Open the database cursor C1 in the database table SFLIGHT for a SELECT statement 

DATA: C1 TYPE CURSOR. 

OPEN CURSOR C1 FOR 
     SELECT * FROM SFLIGHT WHERE CARRID = 'LH '.

So, you have an error when opening the database cursor, in the way how you declared the instruction.

Read only

Former Member
0 Likes
472

Is this a syntax error? What version of R/3 are you on?

Rob

Read only

Former Member
0 Likes
472

hi,

just check from SE11 if the table but000 exists....

also just check if you have declared the variable

first_name in the data declaration...

Thanks,

Sid