‎2011 Apr 05 2:26 PM
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
‎2011 Apr 05 2:42 PM
Please read sap help link[EXEC SQL-Statements for cursor processing|http://help.sap.com/abapdocu_70/en/ABAPEXEC.htm]
‎2011 Apr 05 2:49 PM
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
‎2011 Apr 05 2:59 PM
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]
‎2011 Apr 05 2:59 PM
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
‎2011 Apr 05 3:17 PM
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?
‎2011 Apr 05 3:24 PM
Sorry I dont have any idea how to work with cl_sql_statement and cursor
Regard
Arshad