Skip to Content
Technical Articles
Author's profile photo Amy King

Code Snippet Series: Case Insensitive Table Query

This post is part of a series on code snippets. The complete list of posts in the series is available in the document Code Snippets: A Blog Series.

The ability to query case-sensitive data in a case-insensitive way is a frequent request from both business owners user groups. Examples include searching for a surname “McDonough” or an equipment model “F123b-A”. Users may not know the correct capitalization and a caps-only field may not be available in the database table.

Case-insensitive comparison is possible in Open SQL with the release of SAP_BASIS 751. On older releases, we can use native SQL to perform a case-insensitive query of any database table.

      EXEC SQL.
        SELECT equnr
               FROM equi
               INTO :the_equnr
               WHERE UPPER(herst) = :an_uppercase_herst
               AND   UPPER(serge) = :an_uppercase_serge
               AND   UPPER(typbz) = :an_uppercase_typbz
    CATCH cx_sy_native_sql_error .

Assigned Tags

      You must be Logged on to comment or reply to a post.
      Author's profile photo Former Member
      Former Member

      Hi Amy,

      Nice to see you back.

      With ABAP 751 Open SQL supports the case insensitive functionality:



      Author's profile photo Amy King
      Amy King
      Blog Post Author

      Thanks Suhas, we were still on 740 when I wrote this. I'll update with a link to Horst's blog post.

      Author's profile photo Jelena Perfiljeva
      Jelena Perfiljeva

      Amy, the link points to There are no more "documents" on SCN, you might want to update this.

      Also we can use "user tags" now, so if you would tag all the posts with, say, "ABAP snipper" then everyone could easily find them just by clicking on the tag link. And those tags can actually be followed, as I understand.

      Author's profile photo Amy King
      Amy King
      Blog Post Author

      Thanks for the heads up Jelena. I'm not sure I want to go back and edit every post I've made to update the links. That seems like a lot to ask of authors when SAP reorganizes the site. I notice SAP does forward from to the new location on Hopefully they'll continue to do so.