Skip to Content
-2

How to replace double quotes with single quote in AMDP ?

Hello Folks,

How to replace double quotes " with single ' quotes in AMDP?

I tried this way SELECT REPLACE (:lv_String, '"', '''') "replace" FROM DUMMY; but it's not worked for me, getting below error.

String is '( Material EQ "RMME03" OR Material EQ "RM122" )'

Expecting result is `( Material EQ 'RMME03' OR Material EQ 'RM122' )`.

is there any ways? could you please help me on this?

Thanks & Kind Regards,

Bhargava

skvmj.png (32.8 kB)
Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

1 Answer

  • Best Answer
    Posted on Jul 25, 2020 at 05:57 PM

    The error message doesn't say that you have an error with REPLACE, it says that the filter in APPLY_FILTER is invalid:

    SQLScript APPLY_FILTER: Invalid filter: '( Mat EQ ''A'' OR Mat EQ ''B'' )'

    Probably it's because EQ is invalid in SQL for HANA. Use = instead:

    ( Mat = 'A' OR Mat = 'B' )

    Note that maybe you were distracted by the presence of consecutive single quotes in the error message which made you think that HANA considers two single quotes, but in fact I guess it's just doubled for the output of the error message because if you had used a literal instead of a variable for APPLY_FILTER, you would have entered with two consecutive single quotes, like this:

    result = APPLY_FILTER( tablename, '( Mat = ''A'' OR Mat = ''B'' )' )
    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.