Skip to Content

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. With native SQL we can perform a case-insensitive query of any database table.

  TRY.
      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
      ENDEXEC.
    CATCH cx_sy_native_sql_error .
  ENDTRY.
To report this post you need to login first.

2 Comments

You must be Logged on to comment or reply to a post.

  1. Jelena Perfiljeva

    Amy, the link points to scn.sap.com. 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.

    (0) 

Leave a Reply