SAP TREX_EXT_SEARCH_DOCUMENTS700 Function Module for Search
TREX_EXT_SEARCH_DOCUMENTS700 is a standard trex ext search documents700 SAP function module available within SAP R/3 or S/4 Hana systems, depending on your version and release level. It is used for Search processing and below is the pattern details for this FM, showing its interface including any import and export parameters, exceptions etc. there is also a full "cut and paste" ABAP pattern code example, along with implementation ABAP coding, documentation and contribution comments specific to this or related objects.
See here to view full function module documentation and code listing for trex ext search documents700 FM, simply by entering the name TREX_EXT_SEARCH_DOCUMENTS700 into the relevant SAP transaction such as SE37 or SE38.
Function Group: TREX_700
Program Name: SAPLTREX_700
Main Program: SAPLTREX_700
Appliation area:
Release date: N/A
Mode(Normal, Remote etc): Normal Function Module
Update:

Function TREX_EXT_SEARCH_DOCUMENTS700 pattern details
In-order to call this FM within your sap programs, simply using the below ABAP pattern details to trigger the function call...or see the full ABAP code listing at the end of this article. You can simply cut and paste this code into your ABAP progrom as it is, including variable declarations.CALL FUNCTION 'TREX_EXT_SEARCH_DOCUMENTS700'"Search.
EXPORTING
I_INDEXES = "Indexes
* I_REQ_ATTRIBUTES = "Requested attributes
* I_REQ_JOIN_ATTRIBUTES = "Requested attributes with indexId and join path
* I_HIGHLIGHT_ATTRIBUTES = "Attributes for highlighting
* I_FREESTYLE_SEARCH_ATTRIBUTES = "Attributes for freestyle search
* I_FREESTYLE_SEARCH_ATTRIBUTES2 = "Freestyle Attributes
* I_REQUESTED_RESULTS = 1 "1: documents 2: statistical info 3: statistical overview 8: attr search
* I_COUNT_ONLY = '' "X: result documents are only counted
* I_STAGING = 0 "Staging, 0: false, 1: true
* I_ATTR_DIST_GLOBAL = "Attribute distribution: Global settings
* I_ATTR_DIST_DEFINITION = "Attribute distribution: Definition
* I_RFC_DESTINATION = "RFC Destination
* I_SNIPPET_ATTRIBUTES = "Snippets for text attributes
* I_SIM_QUERY = "Query for similar object search
* I_HINTS = "Hints for the optimizer
* I_PLACEHOLDERS = "placeholder
* I_SWITCH_ON_TRACE = "1: python trace, 2: executor (plan), 3:1+ 2, 4:normal trace
* I_TRACE_COMPONENTS = "Trace component
* I_REQUESTED_LANGUAGES = "Optional: languages range list (for output)
* I_RESULT_INDEX_NAME = "Optional: Index Id for Result Index
* I_INDEXSERVER_LOCATION = "Indexserver (Host:Port)
* I_RESULT_FROM = 1 "from
* I_RESULT_TO = 20 "to
* I_MAX_SNIPPET_WORDS = 30 "Maximum number of word in snippets
* I_REQUEST_FLAGS = 0 "1: DidYouMean, 2: Snippets, 32: Administered Links
I_QUERY_ENTRIES = "Query Entries
* I_SORT_ATTRIBUTES = "Sort attributes
IMPORTING
E_RETURN_CODE = "Return code
E_NO_OF_ALL_HITS = "Total number of hits in index
E_INDEX_SIZE = "Number of documents in index
E_TERM_ATTR_INFOS = "term attr info
E_COMPONENT_RUNTIME = "Run time of the TREX components
E_TRACE = "trace
E_RETURN_TEXT = "Return text
E_RESULT_DOCS = "Result documents
E_ADMINISTERED_RESULT_DOCS = "Administered result documents
E_ATTR_DIST_VALUES = "Attribute distribution values
E_ATTR_DIST_RANGES = "Attribute distribution ranges
E_ATTR_DIST_OVERVIEWS = "Attribute distribution overviews
E_SUGGESTED_TERMS = "DidYouMean
E_NO_OF_HITS = "Number of hits returned
EXCEPTIONS
CONVERSION_ERROR = 1 ERROR = 2
IMPORTING Parameters details for TREX_EXT_SEARCH_DOCUMENTS700
I_INDEXES - Indexes
Data type: TREXT_INDEXLISTOptional: No
Call by Reference: Yes
I_REQ_ATTRIBUTES - Requested attributes
Data type: TREXT_ATTRIBUTESOptional: Yes
Call by Reference: Yes
I_REQ_JOIN_ATTRIBUTES - Requested attributes with indexId and join path
Data type: TREXT_JOIN_ATTRIBUTESOptional: Yes
Call by Reference: Yes
I_HIGHLIGHT_ATTRIBUTES - Attributes for highlighting
Data type: TREXT_ATTRIBUTESOptional: Yes
Call by Reference: Yes
I_FREESTYLE_SEARCH_ATTRIBUTES - Attributes for freestyle search
Data type: TREXT_ATTRIBUTESOptional: Yes
Call by Reference: Yes
I_FREESTYLE_SEARCH_ATTRIBUTES2 - Freestyle Attributes
Data type: TREXT_FREESTYLE_ATTRIBUTESOptional: Yes
Call by Reference: Yes
I_REQUESTED_RESULTS - 1: documents 2: statistical info 3: statistical overview 8: attr search
Data type: TREX_RFC-REQUESTED_RESULTSDefault: 1
Optional: Yes
Call by Reference: Yes
I_COUNT_ONLY - X: result documents are only counted
Data type: TREX_RFC-FLAGDefault: ''
Optional: Yes
Call by Reference: Yes
I_STAGING - Staging, 0: false, 1: true
Data type: TREX_RFC-BOOLEANOptional: Yes
Call by Reference: Yes
I_ATTR_DIST_GLOBAL - Attribute distribution: Global settings
Data type: TREXS_ATTR_DIST_GLOBALOptional: Yes
Call by Reference: Yes
I_ATTR_DIST_DEFINITION - Attribute distribution: Definition
Data type: TREXT_ATTR_DIST_DEFINITIONOptional: Yes
Call by Reference: Yes
I_RFC_DESTINATION - RFC Destination
Data type: TREX_RFC-RFC_DESTINATIONOptional: Yes
Call by Reference: Yes
I_SNIPPET_ATTRIBUTES - Snippets for text attributes
Data type: TREXT_ATTRIBUTESOptional: Yes
Call by Reference: Yes
I_SIM_QUERY - Query for similar object search
Data type: TREXT_SIM_SEARCH_QUERY_ENTRIESOptional: Yes
Call by Reference: Yes
I_HINTS - Hints for the optimizer
Data type: TREXT_HINTSOptional: Yes
Call by Reference: Yes
I_PLACEHOLDERS - placeholder
Data type: TREXT_PLACEHOLDERSOptional: Yes
Call by Reference: Yes
I_SWITCH_ON_TRACE - 1: python trace, 2: executor (plan), 3:1+ 2, 4:normal trace
Data type: NUMC2Optional: Yes
Call by Reference: Yes
I_TRACE_COMPONENTS - Trace component
Data type: CHAR128Optional: Yes
Call by Reference: Yes
I_REQUESTED_LANGUAGES - Optional: languages range list (for output)
Data type: TREXT_LANGUAGESOptional: Yes
Call by Reference: Yes
I_RESULT_INDEX_NAME - Optional: Index Id for Result Index
Data type: TREXD_INDEX_IDOptional: Yes
Call by Reference: Yes
I_INDEXSERVER_LOCATION - Indexserver (Host:Port)
Data type: TREX_RFC-LOCATIONOptional: Yes
Call by Reference: Yes
I_RESULT_FROM - from
Data type: IDefault: 1
Optional: Yes
Call by Reference: Yes
I_RESULT_TO - to
Data type: IDefault: 20
Optional: Yes
Call by Reference: Yes
I_MAX_SNIPPET_WORDS - Maximum number of word in snippets
Data type: IDefault: 30
Optional: Yes
Call by Reference: Yes
I_REQUEST_FLAGS - 1: DidYouMean, 2: Snippets, 32: Administered Links
Data type: TREX_RFC-REQUEST_FLAGOptional: Yes
Call by Reference: Yes
I_QUERY_ENTRIES - Query Entries
Data type: TREXT_QUERY_ENTRIESOptional: No
Call by Reference: Yes
I_SORT_ATTRIBUTES - Sort attributes
Data type: TREXT_SORT_ATTRIBUTESOptional: Yes
Call by Reference: Yes
EXPORTING Parameters details for TREX_EXT_SEARCH_DOCUMENTS700
E_RETURN_CODE - Return code
Data type: TREX_RFC-RETURN_CODEOptional: No
Call by Reference: Yes
E_NO_OF_ALL_HITS - Total number of hits in index
Data type: IOptional: No
Call by Reference: Yes
E_INDEX_SIZE - Number of documents in index
Data type: IOptional: No
Call by Reference: Yes
E_TERM_ATTR_INFOS - term attr info
Data type: TREXT_TERM_ATTR_INFOSOptional: No
Call by Reference: Yes
E_COMPONENT_RUNTIME - Run time of the TREX components
Data type: TREXS_COMPONENT_RUNTIMEOptional: No
Call by Reference: Yes
E_TRACE - trace
Data type: TREXT_LINES_WITH_LBOptional: No
Call by Reference: Yes
E_RETURN_TEXT - Return text
Data type: TREX_RFC-RETURN_TEXTOptional: No
Call by Reference: Yes
E_RESULT_DOCS - Result documents
Data type: TREXT_RESULT_DOCSOptional: No
Call by Reference: Yes
E_ADMINISTERED_RESULT_DOCS - Administered result documents
Data type: TREXT_RESULT_DOCSOptional: No
Call by Reference: Yes
E_ATTR_DIST_VALUES - Attribute distribution values
Data type: TREXT_ATTR_DIST_VALUESOptional: No
Call by Reference: Yes
E_ATTR_DIST_RANGES - Attribute distribution ranges
Data type: TREXT_ATTR_DIST_RANGESOptional: No
Call by Reference: Yes
E_ATTR_DIST_OVERVIEWS - Attribute distribution overviews
Data type: TREXT_ATTR_DIST_OVERVIEWSOptional: No
Call by Reference: Yes
E_SUGGESTED_TERMS - DidYouMean
Data type: TREXT_SUGGESTED_TERMOptional: No
Call by Reference: Yes
E_NO_OF_HITS - Number of hits returned
Data type: IOptional: No
Call by Reference: Yes
EXCEPTIONS details
CONVERSION_ERROR - Error during conversion
Data type:Optional: No
Call by Reference: No ( called with pass by value option)
ERROR - Error, see error message
Data type:Optional: No
Call by Reference: No ( called with pass by value option)
Copy and paste ABAP code example for TREX_EXT_SEARCH_DOCUMENTS700 Function Module
The ABAP code below is a full code listing to execute function module POPUP_TO_CONFIRM including all data declarations. The code uses the original data declarations rather than the latest in-line data DECLARATION SYNTAX but I have included an ABAP code snippet at the end to show how declarations would look using the newer method of declaring data variables on the fly. This will allow you to compare and fully understand the new inline method. Please note some of the newer syntax such as the @DATA is not available until a later 4.70 service pack (SP8), which i why i have stuck to the origianl for this example.| DATA: | ||||
| lv_i_indexes | TYPE TREXT_INDEXLIST, " | |||
| lv_e_return_code | TYPE TREX_RFC-RETURN_CODE, " | |||
| lv_conversion_error | TYPE TREX_RFC, " | |||
| lv_e_no_of_all_hits | TYPE I, " | |||
| lv_i_req_attributes | TYPE TREXT_ATTRIBUTES, " | |||
| lv_e_index_size | TYPE I, " | |||
| lv_i_req_join_attributes | TYPE TREXT_JOIN_ATTRIBUTES, " | |||
| lv_e_term_attr_infos | TYPE TREXT_TERM_ATTR_INFOS, " | |||
| lv_i_highlight_attributes | TYPE TREXT_ATTRIBUTES, " | |||
| lv_e_component_runtime | TYPE TREXS_COMPONENT_RUNTIME, " | |||
| lv_i_freestyle_search_attributes | TYPE TREXT_ATTRIBUTES, " | |||
| lv_e_trace | TYPE TREXT_LINES_WITH_LB, " | |||
| lv_i_freestyle_search_attributes2 | TYPE TREXT_FREESTYLE_ATTRIBUTES, " | |||
| lv_i_requested_results | TYPE TREX_RFC-REQUESTED_RESULTS, " 1 | |||
| lv_i_count_only | TYPE TREX_RFC-FLAG, " '' | |||
| lv_i_staging | TYPE TREX_RFC-BOOLEAN, " 0 | |||
| lv_i_attr_dist_global | TYPE TREXS_ATTR_DIST_GLOBAL, " | |||
| lv_i_attr_dist_definition | TYPE TREXT_ATTR_DIST_DEFINITION, " | |||
| lv_error | TYPE TREXT_ATTR_DIST_DEFINITION, " | |||
| lv_e_return_text | TYPE TREX_RFC-RETURN_TEXT, " | |||
| lv_i_rfc_destination | TYPE TREX_RFC-RFC_DESTINATION, " | |||
| lv_i_snippet_attributes | TYPE TREXT_ATTRIBUTES, " | |||
| lv_i_sim_query | TYPE TREXT_SIM_SEARCH_QUERY_ENTRIES, " | |||
| lv_i_hints | TYPE TREXT_HINTS, " | |||
| lv_i_placeholders | TYPE TREXT_PLACEHOLDERS, " | |||
| lv_i_switch_on_trace | TYPE NUMC2, " | |||
| lv_i_trace_components | TYPE CHAR128, " | |||
| lv_i_requested_languages | TYPE TREXT_LANGUAGES, " | |||
| lv_i_result_index_name | TYPE TREXD_INDEX_ID, " | |||
| lv_e_result_docs | TYPE TREXT_RESULT_DOCS, " | |||
| lv_i_indexserver_location | TYPE TREX_RFC-LOCATION, " | |||
| lv_i_result_from | TYPE I, " 1 | |||
| lv_e_administered_result_docs | TYPE TREXT_RESULT_DOCS, " | |||
| lv_i_result_to | TYPE I, " 20 | |||
| lv_e_attr_dist_values | TYPE TREXT_ATTR_DIST_VALUES, " | |||
| lv_e_attr_dist_ranges | TYPE TREXT_ATTR_DIST_RANGES, " | |||
| lv_i_max_snippet_words | TYPE I, " 30 | |||
| lv_i_request_flags | TYPE TREX_RFC-REQUEST_FLAG, " 0 | |||
| lv_e_attr_dist_overviews | TYPE TREXT_ATTR_DIST_OVERVIEWS, " | |||
| lv_i_query_entries | TYPE TREXT_QUERY_ENTRIES, " | |||
| lv_e_suggested_terms | TYPE TREXT_SUGGESTED_TERM, " | |||
| lv_e_no_of_hits | TYPE I, " | |||
| lv_i_sort_attributes | TYPE TREXT_SORT_ATTRIBUTES. " |
|   CALL FUNCTION 'TREX_EXT_SEARCH_DOCUMENTS700' "Search |
| EXPORTING | ||
| I_INDEXES | = lv_i_indexes | |
| I_REQ_ATTRIBUTES | = lv_i_req_attributes | |
| I_REQ_JOIN_ATTRIBUTES | = lv_i_req_join_attributes | |
| I_HIGHLIGHT_ATTRIBUTES | = lv_i_highlight_attributes | |
| I_FREESTYLE_SEARCH_ATTRIBUTES | = lv_i_freestyle_search_attributes | |
| I_FREESTYLE_SEARCH_ATTRIBUTES2 | = lv_i_freestyle_search_attributes2 | |
| I_REQUESTED_RESULTS | = lv_i_requested_results | |
| I_COUNT_ONLY | = lv_i_count_only | |
| I_STAGING | = lv_i_staging | |
| I_ATTR_DIST_GLOBAL | = lv_i_attr_dist_global | |
| I_ATTR_DIST_DEFINITION | = lv_i_attr_dist_definition | |
| I_RFC_DESTINATION | = lv_i_rfc_destination | |
| I_SNIPPET_ATTRIBUTES | = lv_i_snippet_attributes | |
| I_SIM_QUERY | = lv_i_sim_query | |
| I_HINTS | = lv_i_hints | |
| I_PLACEHOLDERS | = lv_i_placeholders | |
| I_SWITCH_ON_TRACE | = lv_i_switch_on_trace | |
| I_TRACE_COMPONENTS | = lv_i_trace_components | |
| I_REQUESTED_LANGUAGES | = lv_i_requested_languages | |
| I_RESULT_INDEX_NAME | = lv_i_result_index_name | |
| I_INDEXSERVER_LOCATION | = lv_i_indexserver_location | |
| I_RESULT_FROM | = lv_i_result_from | |
| I_RESULT_TO | = lv_i_result_to | |
| I_MAX_SNIPPET_WORDS | = lv_i_max_snippet_words | |
| I_REQUEST_FLAGS | = lv_i_request_flags | |
| I_QUERY_ENTRIES | = lv_i_query_entries | |
| I_SORT_ATTRIBUTES | = lv_i_sort_attributes | |
| IMPORTING | ||
| E_RETURN_CODE | = lv_e_return_code | |
| E_NO_OF_ALL_HITS | = lv_e_no_of_all_hits | |
| E_INDEX_SIZE | = lv_e_index_size | |
| E_TERM_ATTR_INFOS | = lv_e_term_attr_infos | |
| E_COMPONENT_RUNTIME | = lv_e_component_runtime | |
| E_TRACE | = lv_e_trace | |
| E_RETURN_TEXT | = lv_e_return_text | |
| E_RESULT_DOCS | = lv_e_result_docs | |
| E_ADMINISTERED_RESULT_DOCS | = lv_e_administered_result_docs | |
| E_ATTR_DIST_VALUES | = lv_e_attr_dist_values | |
| E_ATTR_DIST_RANGES | = lv_e_attr_dist_ranges | |
| E_ATTR_DIST_OVERVIEWS | = lv_e_attr_dist_overviews | |
| E_SUGGESTED_TERMS | = lv_e_suggested_terms | |
| E_NO_OF_HITS | = lv_e_no_of_hits | |
| EXCEPTIONS | ||
| CONVERSION_ERROR = 1 | ||
| ERROR = 2 | ||
| . " TREX_EXT_SEARCH_DOCUMENTS700 | ||
ABAP code using 7.40 inline data declarations to call FM TREX_EXT_SEARCH_DOCUMENTS700
The below ABAP code uses the newer in-line data declarations. This allows you to see the coding differences/benefits of the later inline syntax. Please note some of the newer syntax below, such as the @DATA is not available until 4.70 EHP 8.| "SELECT single RETURN_CODE FROM TREX_RFC INTO @DATA(ld_e_return_code). | ||||
| "SELECT single REQUESTED_RESULTS FROM TREX_RFC INTO @DATA(ld_i_requested_results). | ||||
| DATA(ld_i_requested_results) | = 1. | |||
| "SELECT single FLAG FROM TREX_RFC INTO @DATA(ld_i_count_only). | ||||
| DATA(ld_i_count_only) | = ''. | |||
| "SELECT single BOOLEAN FROM TREX_RFC INTO @DATA(ld_i_staging). | ||||
| "SELECT single RETURN_TEXT FROM TREX_RFC INTO @DATA(ld_e_return_text). | ||||
| "SELECT single RFC_DESTINATION FROM TREX_RFC INTO @DATA(ld_i_rfc_destination). | ||||
| "SELECT single LOCATION FROM TREX_RFC INTO @DATA(ld_i_indexserver_location). | ||||
| DATA(ld_i_result_from) | = 1. | |||
| DATA(ld_i_result_to) | = 20. | |||
| DATA(ld_i_max_snippet_words) | = 30. | |||
| "SELECT single REQUEST_FLAG FROM TREX_RFC INTO @DATA(ld_i_request_flags). | ||||
Search for further information about these or an SAP related objects