cancel
Showing results for 
Search instead for 
Did you mean: 

Like Search in ABAP CDS based on multiple parameter

0 Kudos

Hi,

I have a requirement to build a parameterized CDS view to display a list of values based on few search criteria. The requiremnt is as below:

1. User can enter a company code or can enter desacription. Description may not be full always meaning user can provide part of the description for 'Like Search'.

I want to create a CDS view to be able to receive 2 parameters and the able to search the required entries and return the output list.

If anybody has created a CDS for similar requirment then please let me know the steps.

A quick response would be appreciated.

Regards,

NM

Accepted Solutions (0)

Answers (1)

Answers (1)

maheshpalavalli
Active Contributor
0 Kudos

You can create a normal view and pass the burks and description as the filters, you dont need to go for parameters atleast here. So if you pass those 2 as filters you can perform like or like not or equal or use any sql search operators.

0 Kudos

Hi Mahesh,

Thanks for your response.

You mean to say I can create a consusmption view with out any condition in the where clause and when I try to call the Odata service I can pass filter in the URL. Is my understanding correct?

Regards,

NM

maheshpalavalli
Active Contributor
0 Kudos

Yup u got it right.. Even if u want to hard code you can set the filters in dpc_ext class in set_query method

0 Kudos

My requirment is to perform a like search by using a particular word from the description. I have checked few filter paramters but I did not find the right one which can allow me to do a like search on Description. Any idea how to do this?

maheshpalavalli
Active Contributor
0 Kudos

From where you want to perform search??? UI5?? or select query in abap??

If UI5-> Pass filter with contains

If abap select query-> pass filter with contains patterns..,

I am not sure how u want to execute the query buddy.. It is just an sql staement, check opensql from sap on how to pass filter quieres or if it is ui5 it is even more easy to pass filters..

Best Regards,

Mahesh

0 Kudos

I tried to use conatins from odata service but it is giving me error where as able to use the filter parameter startswith and endswith.

Regards,

Nitin

maheshpalavalli
Active Contributor
0 Kudos

You have to send the odata query like below:

...servicename/rentalUnitStatusSet?$filter=(substringof('2000',Bukrs))


Please mark this as answered once you verify the same.