Application Development 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: 

DBIF_DSQL2_OBJ_UNKNOWN

Former Member
0 Kudos

Hi Experts,

While I was trying to create a connection from SAP to Oracle server via t-code dbco, I had encountered a runtime error : DBIF_DSQL2_OBJ_UNKNOWN

Exception : CX_SY_NATIVE_SQL_ERROR

I also visited the forums having subject cx_sy_native_sql_error but i didn't find out the solution of mine problem.

Here i m giving u some details abt connection and program

DBconnection Name : mycon

DBMS : ORA

username : KML

password : ***

Connection info : Oracle

Permanent = Checked

Program :

REPORT ZDATAFRMORA_KK .

DATA: c TYPE cursor.

data: begin of ithead occurs 0,

PRODUCT_CODE(9),

MIN_DATE TYPE DATE,

ITEM_CODE(9),

ACCEPT_QTY(20),

PRODUCT_NAME(70),

VEND_CODE(4),

end of ithead.

EXEC SQL.

CONNECT TO 'MYCON' as 'k'

ENDEXEC.

EXEC SQL.

SET CONNECTION 'k'

ENDEXEC.

EXEC SQL.

open c for

SELECT * from ADJ_TEMP

ENDEXEC.

DO.

EXEC SQL.

FETCH NEXT c INTO :ithead

ENDEXEC.

append ithead.

IF sy-subrc ne 0.

EXIT.

ENDIF.

ENDDO.

EXEC SQL.

CLOSE c

ENDEXEC.

EXEC SQL.

DISCONNECT :'MYCON'

ENDEXEC.

loop at ithead.

WRITE: / ithead-PRODUCT_CODE, ithead-ITEM_CODE.

endlooP.

                      • end of report **************

When i execute the above report than its ternimate in between and above error has been occured

I also checked table ADJ_TEMP in oracle server.

Please suggest and help me

Thanks in Advance.

Krishan Kumar

4 REPLIES 4

Sm1tje
Active Contributor
0 Kudos

The exact error is hard to determine, but I would suggest the following:

Put your SQL statements in between TRY ENDTRY clause and catch the runtime error, and retrieve the text for this error.

DATA: lr_error TYPE REF TO CX_SY_NATIVE_SQL_ERROR,

lv_message type string.

TRY.

CATCH CX_SY_NATIVE_SQL_ERROR INTO lr_error.

lv_message = lr_error->get_text( ).

ENDTRY.

Former Member
0 Kudos

Hi Micky Oestreich,

I tried what u write here

Now i m getting a message like "You tried to work with the name of table or view that doesn't exist in the database"

I checked the table adj_temp in the orcle server, dats exist there.

what i will now plz suggest me

Thanks in advance

Krishan Kumar

Former Member
0 Kudos

Hi:

Cause: You worked with the name of a table or a view that does not exist in the database.

Runtime Error: DBIF_DSQL2_OBJ_UNKNOWN

The details are

[Link|http://www.sapnet.ru/abap_docu/ABAPEXEC.htm]

Regards

Shashi

0 Kudos

Dear Shashi,

Thanks for ur suggestion !!!

I go through link.

How can I know I m connected to the Oracle server or not.

Will u help me find out the solution.

I have tried to create a table through sql and when i m trying to insert the data in the table then its gives a error like : " An sql error occured when executing a Native SQL Command"

EXEC SQL.

INSERT INTO AVERI_CLNT1 (CLIENT, ARG1, ARG2, ARG3)

VALUES ('001', 10, 3, 49)

ENDEXEC.

if i make it comment than it gives a error at the statement

EXEC SQL.

DISCONNECT :'MYCON1'

ENDEXEC.

like : "Connection specified is unknown" EXSQL_UNKNOWN_CONNECTION

Now i m confused whether a connection is ok or not.

Whole program like following

REPORT ZDATAFRMORA_KK1 .

DATA: c TYPE cursor.

data: lr_error type ref to cx_sy_native_sql_error,

lv_message type string.

data: begin of ithead occurs 0,

CL(9),

AG1(3),

AG2(3),

FUN(10),

end of ithead.

try.

EXEC SQL.

CONNECT TO 'MYCON1' as 'k'

ENDEXEC.

EXEC SQL.

SET CONNECTION 'k'

ENDEXEC.

*EXEC SQL.

  • CREATE TABLE AVERI_CLNT1 (

  • CLIENT CHAR(3) NOT NULL,

  • ARG1 CHAR(3) NOT NULL,

  • ARG2 CHAR(3) NOT NULL,

  • FUNCTION CHAR(10) NOT NULL,

  • PRIMARY KEY (CLIENT, ARG1, ARG2)

  • )

*ENDEXEC.

*EXEC SQL.

  • INSERT INTO AVERI_CLNT1 (CLIENT, ARG1, ARG2, ARG3)

  • VALUES ('001', 10, 3, 49)

*ENDEXEC.

*

*EXEC SQL.

  • INSERT INTO AVERI_CLNT1 (CLIENT, ARG1, ARG2, ARG3)

  • VALUES ('002', 11, 4, 48)

*ENDEXEC.

EXEC SQL.

open c for

SELECT * from AVERI_CLNT1

ENDEXEC.

DO.

EXEC SQL.

FETCH NEXT c INTO :ithead

ENDEXEC.

append ithead.

IF sy-subrc ne 0.

EXIT.

ENDIF.

ENDDO.

EXEC SQL.

CLOSE c

ENDEXEC.

EXEC SQL.

DISCONNECT :'MYCON1'

ENDEXEC.

CATCH CX_SY_NATIVE_SQL_ERROR INTO lr_error.

lv_message = lr_error->get_text( ).

endtry.

write 😕 lv_message.

loop at ithead.

WRITE: / ithead-CL, ithead-AG1.

I will be highly thankful .

Krishan Kumar