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

external oracle connection

Former Member
0 Likes
1,623

dear all my friends

I have create a connection to an external oracle database using transaction DBCO and it is successfully created and tested.

i do the connection in dbco using the flowing parameter :

DB Connection : ATTEND

DBMS :ORA

Conn. info :ATTEND.WORLD

when i write the flowing native code :

TRY.

EXEC SQL .

connect to 'ATTEND'

ENDEXEC.

CATCH cx_sy_native_sql_error INTO exc_ref.

error_text = exc_ref->get_text( ).

MESSAGE error_text TYPE 'E'.

ENDTRY.

TRY.

EXEC SQL PERFORMING append_wa.

SELECT

USERID,

CARD

FROM TRANS

INTO :wa_jobs

ENDEXEC.

CATCH cx_sy_native_sql_error INTO exc_ref.

error_text = exc_ref->get_text( ).

MESSAGE error_text TYPE 'E'.

ENDTRY.

it pass the connection successfully but it raise error of: The table or view name used does not

exist in the database.

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

and iam sure that the database is connected and the view name is correct .

please what should i do. or please modify the code if i miss something .

9 REPLIES 9
Read only

brunobex
Active Participant
0 Likes
1,530

Hi ahmed Mohamed lamey,

Please do a test to check their connection created in DBCO. Run program ADBC_DEMO

Regards

Bruno Xavier.

Read only

Former Member
0 Likes
1,530

I test it using ( ADBC_DEMO) and it run successfully.

it open connection and create table and fetch data from it normal successfully run .

Read only

0 Likes
1,530

Hi ahmed Mohamed lame,

Ok connection is perfect.

Please make sure you created a table with the same name on SE11 with the same field names. This table created in SE11 will always be empty.

If you do not want to use the same field names, you can use with (select *).

There may be other ways by DBCO but I do not know.

Regards

Bruno Xavier.

Read only

Former Member
0 Likes
1,530

dear Bruno Xavier

i read data from oracle view and i create a table in se11 similar to the view in the oracle and i insert one row on it .

when i hash the code of "connect to 'ATTEND' " it get values from the SAP database when i run without hash the code it return that :The table or view name used does not

exist in the database.

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

i also , do the steps in the flowing link : http://www.mattbartlett.co.uk/connecting-sap-on-microsoft-sql-to-an-external-oracle-db/

and use the code sample in the flowing link with modification in select statement : http://www.mattbartlett.co.uk/downloads/ABAP-Sample-ZMSSQLDEMO.txt

please help me in this problem .

thanks

Read only

0 Likes
1,530

Hi Hi ahmed Mohamed lame,

DBCO you can use openSQL. Create an synonyms for your table TRANS called ZTRANS in the database.

Create the table ZTRANS in SE11.

Please see link for synonyms: [CREATE SYNONYM|http://docs.oracle.com/cd/B19306_01/server.102/b14200/statements_7001.htm]


data: t_ztrans type STANDARD TABLE OF ztrans.

PARAMETERS: p_con TYPE dbcon-con_name OBLIGATORY DEFAULT 'ATTEND'.

TRY .
    SELECT *
      INTO CORRESPONDING FIELDS OF TABLE t_ztrans
      FROM ZTRANS CONNECTION (p_con).
  CATCH cx_root.
*Error
    MESSAGE e208(00) WITH p_con.
ENDTRY.

Regards

Bruno Xavier.

Read only

Former Member
0 Likes
1,530

dear Bruno Xavier

i do the connection and test it sucessfuly connected using ADBC_DEMO program .

also i create the same table with the same name in the data base oracle and the same in se11 transaction .

and i mack acheck for the connection using comand prombet and it sucessfuly connected, and i coby and bast your code

it return the same error as flowing : A table is referred to in an SAP Open SQL statement that either does not

exist or is unknown to the ABAP Data Dictionary.

The table involved is "ZJOBS " or another table accessed in the statement.

please help me

Read only

Former Member
0 Likes
1,530

dear Bruno Xavier

i do the connection and test it sucessfuly connected using ADBC_DEMO program .

also i create the same table with the same name in the data base oracle and the same in se11 transaction .

and i mack acheck for the connection using comand prombet and it sucessfuly connected, and i coby and bast your code

it return the same error as flowing : A table is referred to in an SAP Open SQL statement that either does not

exist or is unknown to the ABAP Data Dictionary.

The table involved is "ZJOBS " or another table accessed in the statement.

please help me

Read only

0 Likes
1,530

Hi ahmed,

I thought it was your table TRANS as the code I posted earlier.


TRY.
EXEC SQL PERFORMING append_wa.
SELECT
USERID,
CARD
FROM TRANS

You've created a synonym?

BR,

Bruno Xavier.

Read only

Former Member
0 Likes
1,530

thanks

problem solved