For a long time I have heard about Enterprise Search as a must have for S/4HANA.
I’ve been able to find very good documentation about activating and setting it up but never had the time or requirement to go deeper into it.
If you are just starting please check SAP Note: 2626107 – How to execute task list SAP_ESH_INITIAL_SETUP_WRK_CLIENT
There is also a learning video where you get the overall picture and further resources
Microlearning video: Activating Enterprise Search for SAP Fiori
I won’t go into more details about activating ESH, what I would like to share in this blog post is more specific to building search models with Long Text search support.
SAP provides documentation for building a search model but this applies to traditional (also referred as conventional) search models.
This is because at this moment, custom CDS based search models are not supported by SAP as it’s written in SAP note 2636156 – Guidelines for the use of @EnterpriseSearch-annotations.
My understanding is that Enterprise search is in a transition at the moment of writing this blog post, switching from traditional table based search models to CDS based search models.
Search models: Traditional vs CDS based
Initially we explored the standard approach and built traditional search models, but I found the modeling environment (ESH_MODELER t-code) and creating relations for multiple long text types to be too difficult.
The UI layout definition is done using JavaScript-based “Tempo”. Documentation for it can be found at Tempojs but as I am not that good in JavaScript I decided that it was too much learning.
There are other challenges like transporting between systems and the overall feeling form the customer was far from ideal.
See below notes regarding transport handling
1790318 – Importing software components directly into target client
2780400 – Transport/Copy Custom Enterprise Search Models Between Clients
So we decided to explore more on the CDS option as that seems to be the path for standard models as well. See this message received in ESH_DASHBOARD transaction when running a diagnose
There is no official documentation provided, as the custom CDS search models are not supported by SAP, but there are various notes that I found helpful
2399860 – ES: Behavior of CDS-based search connectors
3018839 – Activation/Deactivation of CDS Search Connectors
2814665 – Error handling in Enterprise Search OData service – execution ID
3227405 – How to retrieve activation log of inactive CDS search connector
2407921 – ES: Annotations for CDS-based search connectors
So here we go, below are the details of my exploration of CDS based search models
First, model the CDS view, I won’t go into the details, it has to include the elements that are relevant for search queries and result output.
Then add annotations
- Activate the search capabilities by using @Search.searchable: true
- Generate the search connector by using @EnterpriseSearch.enabled: true
- Elements annotated with @Search.defaultSearchElement: true will become the “freestyle” search attributes that can be used to query the data.
- Annotation @Search.ranking: #HIGH / #MEDIUM / #LOW is setting the importance of a search hit.
- Annotation @EnterpriseSearch.filteringFacet: { displayPosition: 1 } will translate in a filter on the left side of the screen that can be used for interactive navigation/filtering of results.
- @UI.identification annotation is used for the elements that should be visible on UI as query response.
- @UI.headerInfo.title: {value: ‘CdocTitle’} marks the element that is presented on UI as title of the result instance.
- Related applications are added using annotation @Consumption.semanticObject
Enterprise search value comes once search in long texts is possible. As historically in SAP the data is stored in cluster tables STXH / STXL it was always necessary to use FM READ_TEXT at application server level to read the plain texts.
SAP delivers a traditional search model ESH_SAPSCRIPT_TEXT that can be associated with other traditional search connectors and allows searching in long texts.
For CDS based search models, there is no standard mechanism provided by SAP out of the box, therefore a workaround is needed.
Below steps are necessary:
- In your CDS view, create an association with CDS view I_TextObjectPlainLongText
Same approach is used in standard CDS based search models. See CDS I_Product for example association and how it it used in ESH_S_PRODUCT search view.
- Maintain the name of your view in view ESH_V_LT_CDSASOC using SM30 Important: this is considered a modification to SAP delivered content.
This is necessary as otherwise the replication report will not look into your long texts.
- Trigger the replication program ESH_SR_LTXT_REPLICATE
This will then replicate the texts into table ESH_SR_LTXT
Once that is done, your search model will have access to the texts and search queries by long text content should return results.
After all the exploration, I could see that there are ways to get it done in some better variations, depending on how much time you have, the hardware resources as the LTXT table size could be a concern and the complexity of your requirement.
Of course, there are limitations in the use of custom CDS based search models, depending on the system version you have, but I was not able to find a documentation of them.
What I saw until now:
- virtual elements are not allowed
- table functions are not supported
- concatenated fields are not working
Do let me know your experience with it or suggestions for improvement in the comments.
Remember this is an exploration, be careful before going with it in any productive and make sure that all the stakeholders are aware that SAP does not support officially this approach.