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

native SQL - execute procedure - using open cursor

Former Member
0 Likes
1,914

Hi,

I would like your help in the following


  exec sql.
      execute procedure d01.Z_PRICINGREPORT ( IN :v_symandt, IN :v_kschl )
  endexec.

I would like to get the output in a cursor. The following code is giving a native SQL exception.


  exec sql.
    open dbcursor for
      execute procedure d01.Z_PRICINGREPORT ( IN :v_symandt, IN :v_kschl )
  endexec.

Warm Regards,

Abdullah

11 REPLIES 11
Read only

ThomasZloch
Active Contributor
0 Likes
1,624

<incorrect statement removed>

Thomas

Read only

former_member194669
Active Contributor
0 Likes
1,624

I think while calling stored procedure you need to specify whether the parameters are output (OUT), input (IN), or input and output and not on CURSOR.

Please check the SAP Note : 44977

a®

Read only

Former Member
0 Likes
1,624

Moreover, If I specify it in the following way


open dbcursor for 
EXEC d01.Z_PRICINGREPORT '210' 'ZPRE'

it fetches the result but when i specify the parameters in the following way, the query executes with return code 0 but no records are fetched in the cursor.


open dbcursor for 
EXEC d01.Z_PRICINGREPORT v_symandt, v_kschl

v_symandt contains the client

v_kschl contains the condition type

Regards,

Abdullah

Read only

0 Likes
1,624

Hi Experts,

can anyone suggest how to execute a procedure and get the resultset in a cursor using native sql?

Warm Regards

Read only

0 Likes
1,624

If you use the host variable syntax (preceeding colon) it works eg. EXEC d01.Z_PRICINGREPORT :v_symandt, :v_ksch

Regards

Peterl

Read only

Former Member
0 Likes
1,624

Hi,

Please check if it helps you:

Regards,

Rahul

Read only

0 Likes
1,624

Hi Experts,

The issue has not been resolved till now. I tried making a view in the database and querying. It is also degrading performance. I would like to call the stored procedure. Please let me know if it is possible.

Warm Regards,

Abdullah.

Read only

0 Likes
1,624

the SAP demo program ADBC_DEMO helps

Read only

0 Likes
1,624

hi,ZAFCO ABAP

the issue has been resolved?

i think i have met the same issue .There is a Oracle pl/sql stored procedure ,it's have a output parameter of oracle's cursor type,by calling this stored procedure i can get a resuletset.Then,i tried coding as below:

DATA dbcur TYPE cursor

EXEC SQL.

EXECUTE PROCEDURE SP_TEST(out :dbcur)

ENDEXEC.

by notes 44977 i tried as below:

EXEC SQL.

open cr for PROCEDURE SP_TEST(out :dbcur)

ENDEXEC.

But both of above did not resolve it.Pls help me if you have been out of the issue. thanks!

Read only

0 Likes
1,624

This message was moderated.

Read only

Former Member
0 Likes
1,624

This message was moderated.