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: 

How to retrieve stored procedure in oracle using ABAP

Former Member
0 Kudos

Dear,

I have problem on how to retrieve data from oracle in strored procedure... usually data in oracle stored in tables and i usually retrieve them using open dbcursor for select ... but now, the condition is changed.. the data in oracle are stored in refcursor, so i must get it using ABAP..

I've tried to use execute (stored_procedure) with its variable input and output.. but still can't work...

below is my syntax :

DATA : BEGIN OF et_refcursor2,

account_num(20) TYPE c,

customer_ref(20) TYPE c,

product_seq(9) TYPE c,

product_id(9) TYPE c,

product_attr_subid(9) TYPE c,

change_start_dat TYPE dats,

attribut_value(40) TYPE c,

charge_end_dat TYPE dats,

END OF et_refcursor2.

data et_refcursor like table of et_refcursor2.

try.

exec sql.

execute procedure c_getearlytermination( IN :i_iddb, IN :i_nper,

OUT :et_refcursor )

endexec.

  • write : / et_refcursor.

catch cx_sy_native_sql_error. "add by taufik under D10K924982

message 'Can not execute stored procedure.. ' type 'I'.

endtry.

Can anyone can help me? appreciate any help regarding this matter...

Thank you very much...

Bre H.

4 REPLIES 4

raymond_giuseppi
Active Contributor
0 Kudos

Did you try a CURSOR/PROCEDURE syntax like ([Note 44977 - EXEC SQL: New features|https://service.sap.com/sap/support/notes/44977])

<proc_cursor> = OPEN <cursor_name> FOR <procedure>

<fetch_cursor> = FETCH NEXT <cursor_name>

<close_cursor> = CLOSE <cursor_name>

Regards,

Raymond

0 Kudos

Yes I did.. but still can not... the challenge is not to use the open or fetch ... cause if I use that, so whenever there's changes in other system, ABAP side must be changed too... while the objective is not to change in ABAP when there's changes in data field later...

regards,

Taufik

SuhaSaha
Advisor
Advisor
0 Kudos

Hello Bre H.,

Why don't you use the [ADBC classes(CL_SQL*)|http://help.sap.com/abapdocu_702/en/abenadbc.htm]?

To get data from the Stored Proc you can use the instance method EXECUTE_PROCEDURE( ) of the class CL_SQL_STATEMENT.

BR,

Suhas

Former Member
0 Kudos

Helllo Suha,

Thank you very much... even my problem still can't solve yet, but your ADBC suggestion is very helpfull to me.. I am studying it so later I can use it to solve my problem... but currently I used different method to solve it...but still not good as if I use ADBC..

Thank you Suha...

regards,

Taufik