I have an existing method in a class that returns a list of ids that I would like to use in the search help of a data element (using SE11 transaction). I have been looking for a way to use the method in the search help of my data element but so far I haven't been able to find any way.
Is it possible to use a method while setting up a search help in SE11 or do I only have rely on table, view or CDS views ?
What you need is to create a search help that has a search help exit, and then assign this search help to the data element. Inside the exit you can add any ABAP code you want, including calling the method to retrieve the IDs. You create the custom search help via SE11, and assign it to the data element in the tab Further Attributes also in SE11.
A good tutorial on how to accomplish is here: https://blogs.sap.com/2009/03/11/controllingmanipulating-data-of-search-help-using-search-help-exit/ but this is widely used so you can just search for "search help exit in abap" and you will find many tutorials, including in youtube. Also I am assuming you have access to a system, so you can search in SE11 for search helps and use one with a search help exit as reference.