Skip to Content
Technical Articles
Author's profile photo Uladzislau Pralat

User-defined functions are not supported in the SEARCHED CASE WHEN clause. What are your options?

If you worked on complex S/4HANA ABAP CDS views, you probably run into “User-defined functions are not supported in the SEARCHED CASE WHEN clause” error message. You can workaround this problem either splitting complex view into 2 more simple nested views or implementing AMDP table function. But what if you are too lazy to do that, then smart solution described in this blog is for you.

According to documentation, indeed user-defined functions are not supported in the SEARCHED CASE WHEN clause. Like in my example, LEFT and SUBSTRING functions are not supported. But the same documentation  provides you a solution as well РLIKE pattern comparisons.

All it takes in my case, is to think out the box and replace string functions with LIKE pattern comparisons

 

 

Assigned Tags

      1 Comment
      You must be Logged on to comment or reply to a post.
      Author's profile photo Che Eky
      Che Eky

      Brilliant! This saved me having to create extra CDS views, thank you.