Objective: Search a text string programmatically using Enterprise Search API. Business scenario is to input text and search account and contacts in relation.
We would be exploring the standard classes to check the connection with ESH & get desired search results.
Class CL_ESH_IF_SEARCH_REQUEST is the prime API for using Enterprise Search. Important methods for the class are SET_SEARCH_TEXT, SET_SEARCH_SCOPE, SET_START_INDEX.
The Technical Object can be designed to accept a String(Text) as an input and the Number of hits(Hits), the values returned(Values) and the return message(Msg) as output.
CODE SNIPPET |
---|
DATA: ls_esh_admin TYPE esh_adm_sc_main, lt_partner TYPE zesh_search_account_res, lr_cx TYPE REF TO cx_esh_if_engine. TYPES: BEGIN OF ty_final, DATA: lt_final TYPE ty_final.
Getting the connection details for Accounts SELECT SINGLE * FROM esh_adm_sc_main INTO ls_esh_admin Instantiating the Class instance for Search CREATE OBJECT lr_req. Add Search scope to search for Accounts lr_req->add_search_scope ( EXPORTING iv_connector_id = ls_esh_admin-sc_id Initiating the search Getting number of responses lv_resp_no = lr_resp->get_number_of_responses( ). TRY. |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.