‎2009 Feb 24 10:59 AM
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
‎2009 Feb 24 11:29 AM
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.
‎2009 Feb 24 12:02 PM
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
‎2009 Feb 24 12:15 PM
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
‎2009 Feb 25 9:50 AM
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