2012 May 07 10:45 AM
Hi ABAPers,
I am building a where clause t_where for selection to table:
CONCATENATE 'FIELD_A LIKE ''' '%' z_a '%'''
INTO z_where-text.
APPEND z_where TO t_where.
SELECT * INTO it_table
FROM z_table
WHERE (t_where).
The issue occurs when z_a contain single quote character '. For example z_a = "Test's data"
The where clause is FIELD_A LIKE '%Test's data%'
It will close the statement in '%Test' and will not recognize s data%'.
It cause run time error.
Any idea how to fix this?
Thanks
Regards
Hadi
2012 May 07 11:03 AM
Hello Wadi,
Instead of using single quotes(') to build the dynamic WHERE clause you can safely use backquotes(`). This should prevent the issue.
Please refer to the online documentaion: http://help.sap.com/abapdocu_731/en/abenwhere_logexp_dynamic.htm
BR,
Suhas
2012 May 07 10:49 AM
2012 May 07 11:03 AM
Hello Wadi,
Instead of using single quotes(') to build the dynamic WHERE clause you can safely use backquotes(`). This should prevent the issue.
Please refer to the online documentaion: http://help.sap.com/abapdocu_731/en/abenwhere_logexp_dynamic.htm
BR,
Suhas
2012 May 07 11:14 AM