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

cl_sql_statement and dbcursor

sebastianNoe
Participant
0 Likes
1,275

Hi there!

Currently I am trying to make a native SQL call to a database with the class cl_sql_statement.

Because I am extending existing functionality I would like to get a database cursor with which the program can go on. Is there a possibility to get a 'real' cursor out of cl_sql_statement (not the 'cursor'-called object of class cl_sql_result)?

Or do you have any other suggestions how I could open a cursor via native SQL?

Exec SQL? How should a Open Cursor statement looks there? - I am working on a NewDB

Thank you in advance for your help.

Best Regards,

Sebastian

6 REPLIES 6
Read only

kesavadas_thekkillath
Active Contributor
0 Likes
1,137

Please read sap help link[EXEC SQL-Statements for cursor processing|http://help.sap.com/abapdocu_70/en/ABAPEXEC.htm]

Read only

0 Likes
1,137

Thank you for your quick response.

I have allready read the page you suggested. Unfortunately it can not help me because the SQL statement is generated dynamically and I have only a string. Do you know a way to execute a dynamic built statement with exec sql?

(with dynamic built I ment WHERE, FROM, FIELDS and ORDER BY statements are built up at run time)

Thanks again,

Sebastian

Read only

0 Likes
1,137

Hi,

There are no dynamic Native SQL statements in ABAP.

Please read [SQL Injection|http://help.sap.com/saphelp_nw2004s/helpdata/en/8f/35de1718944eb8a1462cf6362cc8b8/content.htm]

Read only

0 Likes
1,137

Halo Sebastian,

Did you check the ADBC* Demo Programs that illustrates how to use cl_sql_statement class methods

Go to Se38 and check ADBC* programs

Regards

Arshad

Read only

0 Likes
1,137

Hi,

Thanks again for your answers

@ Keshav:

Good to know that the possibility to do dynamic native SQL calls is not given.

Your concern about SQL injection is valid. I see your point. Netherless I have to adopt some statements and because of the dynamic programming style within this project I have to use dynamic SQL statements.

@ Arshad:

I also had a look at the ADBC* programs but could not find any useful about Cursors.

Do you have an idea how to work with cl_sql_statement and cursors?

Read only

0 Likes
1,137

Sorry I dont have any idea how to work with cl_sql_statement and cursor

Regard

Arshad