Skip to Content
0
Former Member
Jan 10, 2006 at 04:27 PM

Dynamic SQL select parameters

28 Views

Until runtime I don't know the table name and column-name on which I have to do a select.

Here is my SQL:

SELECT single <b>w_sum_col_name </b> FROM (w_tbl_name)

INTO ZOH_AUDIT-ZOH_NET1

WHERE REQUID = ZOH_AUDIT-REQUID.

My SQL fails when I have SUM(any_column) in the string w_sum_col_name. However it works if its a just a column name of the table. Failure is when the w_sum_col_name string has an aggregate function.

Error is ..SAPSQL_ILLEGAL_AGGREGATE" CX_SY_DYNAMIC_OSQL_SYNTAX

Any alternatives for my requirement is appreciated.