Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

In SAP Abap CDS, how to do ltrim and implement fuzzy search

I want to do fuzzy search on a field which has leading zeroes, so need to first ltrim the zeroes and implement the fuzzy search. Can anyone help me out on this?

2 REPLIES 2

former_member1716
Active Contributor

Hello skkishor,

There are different approaches for the same as mentioned below:

1) You can Use LTRIM Functionality as shown below

   ltrim( matnr, '0' ) as Mat_Output,  

2) You can try using ABAP CDS cast expressions follow the examples in the LINK for better understanding.

3) You can always use the AMDP concepts, try using CDS with table functions. This will serve the purpose as it covers wide range of syntaxes.

Regards!

juryrychko
Explorer
0 Kudos

Satish's suggestion will not help. Fuzzy search will throw dumps.

You can add one more field from cdc I_Product with below annotations:

@Search.defaultSearchElement: true
@Search.fuzzinessThreshold: 0.8
@Consumption.hidden: true
ProductExternalID

In that case fuzzy search will work using newly added but hidden field.