cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Do CDS Annotations work while querying from ABAP

0 Likes
1,246

I have a requirement of using fuzzy search for searching materials. From my research so far i was able to determine this can be done in Two Ways :

1. Using CONTAINS( param , search_string, FUZZY(0.8) ) in AMDP and calling AMDP within CDS

2. Using CDS Annotations

Q.1 What approach would be best suited to use ?

Additionally , While trying option 2 , i could see that we cannot put the search Annotation on input param so was forced to put it in field selection. This meant i needed a wrapper CDS around original CDS. Roughly the CDS along with its params looks like this. ( Yes There are whole lot of conditions needed to make this better ).

CDS with Search Annotations :

Wrapper CDS :

But when i try to call it in ABAP , i am not able to do a fuzzy search or even a regular search usign the wrapper CDS. The original CD does work but due to lack of input params brings a bug huge list 🙂

Q.2 I am new to CDS so can anyone help in what i could be doing wrong ?

View Entire Topic
junwu
SAP Champion
SAP Champion

cds is for modeling entity relationship, not for sql stuff.

why you need that parameter? expect performance improvement?

0 Likes

in this particular case , its to select Materials but keying in their ranges rather than exact Material number . Additionally we will be putting in search by Material text , Vendor Number etc functionalities but have excluded other details intentionally to make the question concise.

Also , we are currently on NW 7.4 so do not have option to expose directly as OData. So this select will eventually feed a odata service (using SADL model or using OpenSQL query inside appropriate methods ).

junwu
SAP Champion
SAP Champion
0 Likes

i don't get the point to add that parameter.