SAP TREX_EXT_SEARCH_SIMILAR_DOCS Function Module for Search for similar documents









TREX_EXT_SEARCH_SIMILAR_DOCS is a standard trex ext search similar docs 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 for similar documents 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 similar docs FM, simply by entering the name TREX_EXT_SEARCH_SIMILAR_DOCS into the relevant SAP transaction such as SE37 or SE38.

Function Group: TREX_EXT_TM
Program Name: SAPLTREX_EXT_TM
Main Program: SAPLTREX_EXT_TM
Appliation area:
Release date: N/A
Mode(Normal, Remote etc): Normal Function Module
Update:



Function TREX_EXT_SEARCH_SIMILAR_DOCS 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_SIMILAR_DOCS'"Search for similar documents
EXPORTING
I_INDEXES = "Index list
* I_SORT_ATTRIBUTES = "Sort Attributes (not yet implemented)
* I_HIGHLIGHT_ATTRIBUTES = "Attributes for Highlighting
* I_STAGING = 0 "Staging, 0: false, 1: true
* I_RFC_DESTINATION = "RFC Destination
I_SEARCH_DOCS = "Search Docs
* I_INDEXSERVER_LOCATION = "Index server (Host:Port)
* I_RESULT_FROM = 1 "from
* I_RESULT_TO = 20 "to
* I_REQUEST_FLAGS = 0 "1: DidYouMean, 2: Snippets
* I_DOC_SEL_QUERY = "DocumentSelectionQuery
* I_REQ_ATTRIBUTES = "Requested Attributes

IMPORTING
E_RESULT_DOCS = "Result Documents
E_NO_OF_HITS = "Number of hits
E_INDEX_SIZE = "Number of documents in index
E_RETURN_CODE = "Return code
E_RETURN_TEXT = "Return text

EXCEPTIONS
CONVERSION_ERROR = 1 ERROR = 2
.



IMPORTING Parameters details for TREX_EXT_SEARCH_SIMILAR_DOCS

I_INDEXES - Index list

Data type: TREXT_INDEXLIST
Optional: No
Call by Reference: Yes

I_SORT_ATTRIBUTES - Sort Attributes (not yet implemented)

Data type: TREXT_SORT_ATTRIBUTES
Optional: Yes
Call by Reference: Yes

I_HIGHLIGHT_ATTRIBUTES - Attributes for Highlighting

Data type: TREXT_ATTRIBUTES
Optional: Yes
Call by Reference: Yes

I_STAGING - Staging, 0: false, 1: true

Data type: TREX_RFC-BOOLEAN
Optional: Yes
Call by Reference: Yes

I_RFC_DESTINATION - RFC Destination

Data type: TREX_RFC-RFC_DESTINATION
Optional: Yes
Call by Reference: Yes

I_SEARCH_DOCS - Search Docs

Data type: TREXT_SEARCH_DOCS
Optional: No
Call by Reference: Yes

I_INDEXSERVER_LOCATION - Index server (Host:Port)

Data type: TREX_RFC-LOCATION
Optional: Yes
Call by Reference: Yes

I_RESULT_FROM - from

Data type: I
Default: 1
Optional: Yes
Call by Reference: Yes

I_RESULT_TO - to

Data type: I
Default: 20
Optional: Yes
Call by Reference: Yes

I_REQUEST_FLAGS - 1: DidYouMean, 2: Snippets

Data type: TREX_RFC-REQUEST_FLAG
Optional: Yes
Call by Reference: Yes

I_DOC_SEL_QUERY - DocumentSelectionQuery

Data type: TREX_RFC-DOC_SEL_QUERY
Optional: Yes
Call by Reference: Yes

I_REQ_ATTRIBUTES - Requested Attributes

Data type: TREXT_ATTRIBUTES
Optional: Yes
Call by Reference: Yes

EXPORTING Parameters details for TREX_EXT_SEARCH_SIMILAR_DOCS

E_RESULT_DOCS - Result Documents

Data type: TREXT_RESULT_DOCS
Optional: No
Call by Reference: Yes

E_NO_OF_HITS - Number of hits

Data type: I
Optional: No
Call by Reference: Yes

E_INDEX_SIZE - Number of documents in index

Data type: I
Optional: No
Call by Reference: Yes

E_RETURN_CODE - Return code

Data type: TREX_RFC-RETURN_CODE
Optional: No
Call by Reference: Yes

E_RETURN_TEXT - Return text

Data type: TREX_RFC-RETURN_TEXT
Optional: No
Call by Reference: Yes

EXCEPTIONS details

CONVERSION_ERROR - Error during Conversion from/to UTF-8

Data type:
Optional: No
Call by Reference: Yes

ERROR - Error, see Error Message

Data type:
Optional: No
Call by Reference: Yes

Copy and paste ABAP code example for TREX_EXT_SEARCH_SIMILAR_DOCS 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_result_docs  TYPE TREXT_RESULT_DOCS, "   
lv_conversion_error  TYPE TREXT_RESULT_DOCS, "   
lv_i_sort_attributes  TYPE TREXT_SORT_ATTRIBUTES, "   
lv_i_highlight_attributes  TYPE TREXT_ATTRIBUTES, "   
lv_i_staging  TYPE TREX_RFC-BOOLEAN, "   0
lv_error  TYPE TREX_RFC, "   
lv_e_no_of_hits  TYPE I, "   
lv_i_rfc_destination  TYPE TREX_RFC-RFC_DESTINATION, "   
lv_e_index_size  TYPE I, "   
lv_i_search_docs  TYPE TREXT_SEARCH_DOCS, "   
lv_e_return_code  TYPE TREX_RFC-RETURN_CODE, "   
lv_i_indexserver_location  TYPE TREX_RFC-LOCATION, "   
lv_e_return_text  TYPE TREX_RFC-RETURN_TEXT, "   
lv_i_result_from  TYPE I, "   1
lv_i_result_to  TYPE I, "   20
lv_i_request_flags  TYPE TREX_RFC-REQUEST_FLAG, "   0
lv_i_doc_sel_query  TYPE TREX_RFC-DOC_SEL_QUERY, "   
lv_i_req_attributes  TYPE TREXT_ATTRIBUTES. "   

  CALL FUNCTION 'TREX_EXT_SEARCH_SIMILAR_DOCS'  "Search for similar documents
    EXPORTING
         I_INDEXES = lv_i_indexes
         I_SORT_ATTRIBUTES = lv_i_sort_attributes
         I_HIGHLIGHT_ATTRIBUTES = lv_i_highlight_attributes
         I_STAGING = lv_i_staging
         I_RFC_DESTINATION = lv_i_rfc_destination
         I_SEARCH_DOCS = lv_i_search_docs
         I_INDEXSERVER_LOCATION = lv_i_indexserver_location
         I_RESULT_FROM = lv_i_result_from
         I_RESULT_TO = lv_i_result_to
         I_REQUEST_FLAGS = lv_i_request_flags
         I_DOC_SEL_QUERY = lv_i_doc_sel_query
         I_REQ_ATTRIBUTES = lv_i_req_attributes
    IMPORTING
         E_RESULT_DOCS = lv_e_result_docs
         E_NO_OF_HITS = lv_e_no_of_hits
         E_INDEX_SIZE = lv_e_index_size
         E_RETURN_CODE = lv_e_return_code
         E_RETURN_TEXT = lv_e_return_text
    EXCEPTIONS
        CONVERSION_ERROR = 1
        ERROR = 2
. " TREX_EXT_SEARCH_SIMILAR_DOCS




ABAP code using 7.40 inline data declarations to call FM TREX_EXT_SEARCH_SIMILAR_DOCS

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 BOOLEAN FROM TREX_RFC INTO @DATA(ld_i_staging).
 
 
 
"SELECT single RFC_DESTINATION FROM TREX_RFC INTO @DATA(ld_i_rfc_destination).
 
 
 
"SELECT single RETURN_CODE FROM TREX_RFC INTO @DATA(ld_e_return_code).
 
"SELECT single LOCATION FROM TREX_RFC INTO @DATA(ld_i_indexserver_location).
 
"SELECT single RETURN_TEXT FROM TREX_RFC INTO @DATA(ld_e_return_text).
 
DATA(ld_i_result_from) = 1.
 
DATA(ld_i_result_to) = 20.
 
"SELECT single REQUEST_FLAG FROM TREX_RFC INTO @DATA(ld_i_request_flags).
 
"SELECT single DOC_SEL_QUERY FROM TREX_RFC INTO @DATA(ld_i_doc_sel_query).
 
 


Search for further information about these or an SAP related objects



Comments on this SAP object

What made you want to lookup this SAP object? Please tell us what you were looking for and anything you would like to be included on this page!