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

Object Doesnot exist on the Data Base....??

Former Member
0 Likes
3,738

Hi..All,

I have requirement to read data form Oracle data base(external system) To SAP .

The connections are fine in DBCO and Able to connect to the Oracle server (ITR2) .

And i have done coding as below:

EXEC SQL.
   CONNECT TO 'ITR2'
ENDEXEC.

EXEC SQL.
   open c for
     SELECT * from GDPA_CIS
ENDEXEC.

DO.
   EXEC SQL.
     FETCH NEXT c INTO :it_sap
   ENDEXEC.
   append it_sap.
   IF sy-subrc ne 0.
     EXIT.
   ENDIF.
ENDDO.

EXEC SQL.
   CLOSE c
ENDEXEC.

EXEC SQL.
   DISCONNECT :'ITR2'
ENDEXEC.


I am getting dump AS attached.

How can i trouble shoot this..

7 REPLIES 7
Read only

former_member188458
Active Participant
0 Likes
2,175

Hi Mahesh ,

The best way to troubleshoot is to use the tcode - DBACOCKPIT .

from the dump it seems the Table name you have specified in Native SQL quert SELECT * FROM <TABNAME> does not exist in the underlying DB connection "DEFAULT"

You can try to directly execute the query in "SQL Command Editor" ( In Diagnostics node)  there , using the native DB query Language  and see if  the object exists

Hope it helps .

Best Regards,

Rini

P.S : Pls mark the answer as correct/helpful if so.

Read only

0 Likes
2,175

Hi..Rini,

The Table is there in External Oracle data base .

And am able to connect to the external DB with below syntax.

EXEC SQL.

   CONNECT TO 'ITR2'

ENDEXEC.

But when reading table with below syntax- its going to dump.

EXEC SQL.

   open c for

     SELECT * from GDPA_CIS

ENDEXEC.



Still any settings missing...

Read only

0 Likes
2,175

Hi Mahesh ,

As you are using Native SQL , so probably you will also have to specify the system id along with table name . So your query should be like :

   select * from <sap system id>.<table name>

You can also test the above sql command in the SQL Command Editor(under Diagnostics) in tcode - DBACOCKPIT mentioned in my previous reply.

One more suggestion , why do u want to use native as You can also use cursors in Open SQL.

Best Regards,

Rini

P.S : Please mark the answer as helpful or correct if so.

Read only

0 Likes
2,175

Hi,

Try to run the query directly on the console of the external database.

Best Regards from Brazil.

Read only

0 Likes
2,175

Hi..Ferreira,

In Oracle server we have tested the table - GDPA_CIS.

Its there with 20 records.

But when accessing it through ABAP,Its going to dump.

Regards,

Mahesh

Read only

0 Likes
2,175

Hi

Perhaps you need to indicate a particular schema where the table is

Max

Read only

0 Likes
2,175

Hi Mahesh,

After connect to statement , use set connection as below;

EXEC SQL.
   CONNECT TO 'ITR2'
ENDEXEC.


EXEC SQL.

   SET CONNECTION 'ITR2'

ENDEXEC.

IF sy-subrc <> 0.

        RAISE EXCEPTION TYPE cx_sy_native_sql_error.

ENDIF.



EXEC SQL.
   open c for
     SELECT * from GDPA_CIS
ENDEXEC.


Hope it helps,


BR.