We are making a program to show a list. To look for all the information that our customer need, we have to do some rather complex and long SELECT statement. To reduce the cost of maintaining of the program, I´m trying to introduce dynamic code in sentence "WHERE" , depending on the fields that users introduce via selection screen. But I have a problem with dynamic statement " EXISTS " when I execute the program.
I obtain an error 'SAPSQL_INVALID_FIELDNAME' . The program identifies EXISTS as the name of a column.
If i write the literal sentence (no dynamic) the program is correctly executed.
I have read something about to GENERATE SUBROUTINE POOL but at this point this would be more complex than repeat the statement with and without EXISTS depending the selection and in diferent parts of the program. I don´t like and I know it is an awfull solution but it is a solution.
Has had somebody the same problem and has found a solution ?
Thanks for your help