Skip to Content

​Service Layer: How To Filter Results By Single Quote?

Hi,

I’m currently using the filter method on CardName in Service Layer. I want to know how would I do a text search with single quote? For example, William's. Searching online, I heard some people use double single quotes to make it to work in oData. Below is the sample query I quoted in Service Layer. However, it will not return any results. I think because the single quote after the letter m, Service Layer might be thinking this is the end of my filter for CardName. Can you advise a way I can make a query like this to work that contains a single quote?

https://~~~~:50000/b1s/v1/BusinessPartners?$filter=CardName eq 'William''s'

Regards,

William

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

  • Best Answer
    Nov 28, 2017 at 06:48 PM

    I made a support ticket with SAP about this issue. Appearnetly it a bug and they will fix it in 9.2 PL10.

    Add comment
    10|10000 characters needed characters exceeded

  • Nov 16, 2017 at 06:47 PM

    you have to encode the single quote...

    try:

    ...=CardName eq 'William's' (replace ' (no spaces -->) & a p o s

    or

    ...=CardName eq 'William%27s' -- (no spaces -->) % 27

    Add comment
    10|10000 characters needed characters exceeded