01-19-2005 6:25 AM
Dear All,
The user will write/enter a
sql query in the screen. The
program should give output of
that sql in the form of records/itab.
How can this be achieved ?
Thanks in advance.
Amit Mittal.
01-19-2005 7:36 AM
Hi,
I wonder how you will carry out the syntax checks in this case. Any way, there are a couple of options available:
1. Use statement GENERATE SUBROUTNE POOL to dynamically generate a transient program and obtain its output in your own program.
2. The other way is that you can obtain column names, table name and where clause from the user in separate fields on screen and use them to construct an OpenSQL statement like <b>SELECT (fieldlist) FROM (tablename) INTO (targetarea) WHERE (whereclause)</b>.
For both options, you can take a look at the document <b>https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/documents/a1-8-4/advanced and generic programming in abap.pdf</b> or TechEd session <b>https://www.sdn.sap.com/sdn/elearning.sdn?class=/public/eclasses/teched04/ABAP351.htm</b> on generic programming.
Hope this helps.
Regards