Вы находитесь на странице: 1из 7

Custom SES TREX Functionality

created by Satish Nair on Jun 26, 2012 11:17 AM, last modified by Satish Nair on Jun 26, 2012 11:43 AM
Version 1
Custom Development for enabling full-text search for Business Objects in
Custom SES TREX Functionality
Applies to:
SAP NetWeaver 2004s, mySAP ERP 2005
Created on:
Satish Nair, Capgemini, M, Sr. Consultant, AppsOne

The SAP NetWeaver Search Engine Service (SES) for business objects is a simple generic interface to enable
indexing and searching of business objects with TREX, SAP NetWeavers engine for search and classification. Any
business object in the sense of the Business Object Repository (BOR) can implement the SES methods and is then
subject to the SES features, including simple full text and fuzzy search as well as advanced attribute search. The
SES is part of the SAP NetWeaver Application Server (AS) ABAP.

There are search helps in SAP for which the SES TREX has not been enabled. SAP provides standard business
objects and their classes for which the TREX functionality can be enabled ( eg: Searching a material using its long
text by full text and fuzzy search functionality ). There are also, search helps in SAP for which SAP does not
provide standard classes for their business objects. In this case, it becomes imperative to develop their classes as per
requirement, so as to enable these business objects for full text and fuzzy search. ( eg: Searching a group task using
its header long text by full text and fuzzy search This is for transaction code IA06/7 Business object 1019 ).

Steps in Extending the Search Engine Service:
The PDF link below gives the procedure for Enabling and activating standard SAP Business objects for SES-TREX

Additional Business objects can be enabled for indexing and searching through SES.
The Steps involved for this are:
Custom Indexing Class
- Create a custom indexing Class i.e enable a new object for indexing. This object has to implement the interface
IF_COM_SE_BUSOBJ. Add attributes to be indexed for the new object. The attributes can contain the keys of the
base table associated with the business objects along with the short text / description field of this table.
- Add methods to this custom indexing class as per the available methods in the standard indexing class.
Code these methods as per the requirement.
- Additional methods can be added as per the requirement with appropriate coding.
- The above steps will cause the search help to include the short text / description field enabled in the search help.
- To add the long text of a transaction code to be included in the search help, do the following step in the custom
1- Create a method within this custom class to read table STXH using FM READ_TEXT.
2- Call this method from the method GET_ATTRIBUTE_VALUES, within the loop when values of other
attributes are extracted.

Example: Create a custom indexing class ZCL_ERP_SE_BUS1019 for BUS1019. Implement interface
IF_COM_SE_BUSOBJ and add attributes as required as shown below.
Implement interface IF_COM_SE_BUSOBJ

Add Attributes as required

Code the available methods of the interface as per requirement. In BUS1019 the method
GET_ATTRIBUTE_VALUES is coded for BUS1019 for base table PLKO to extract attributes
PLNNR, PLNAL and short text LTXT. Sample code for this method for extracting PLNTY is
Methods added:

Sample code for method GET_ATTRIBUTE_VALUES for extracting field PLNTY from table PLKO

LOOP AT lt_plko_total INTO ls_plko_total.
clear ls_object_ids.

* Common block
lr_assist->add_object( ls_object_ids ).
iv_dd_obj = if_com_se_busobj_name_assist=>gc_de_business_object
iv_value = iv_busobj ).

* Header data
ld_attribute = gc_fieldname_plnty.
ld_value = ls_plko_total-plnty.
iv_name = gc_fieldname_plnty
iv_dd_obj = gc_rollname_plnty
iv_value = ls_plko_total-plnty
iv_content_relevant = 'X' ).

Additional method ADD_TEXT_TO_CONTENT is added for extracting long text. This method
called from the method GET_ATTRIBUTE_VALUE. The code snippet for this method is given

id = iv_id
language = iv_langu
name = iv_name
object = lc_object
lines = lt_tline
others = 0.

tab_substitute = ' 1'
c_datatab = lt_ascii
itf_lines = lt_tline.

LOOP AT lt_ascii ASSIGNING <lv_ascii>.
CONCATENATE ls_content-content <lv_ascii>
INTO ls_content-content
if not ls_content-content is initial.
call method ir_assist->add_content
iv_value = ls_content-content.

Configuration (SPRO) Steps:

- Do configuration for the SES functionality of this business object whose path is as given below:

- Add entries for the business object and do its settings as given in below screen shots:

Search Engine Service Administration:

- Using transaction code SES_ADMIN, create this custom index entry and execute its full indexing.

Search Help Creation:

- Create two custom elementary search helps i.e the QUICK and ADVANCED Search help. Use search help exit
COM_SE_F4_HELP_EXIT in their definition. The search help parameters required should be the attributes of the
base table used in the above created custom class.
- Create a custom collective search help which includes both of these elementary search helps. Append this custom
collective search help to the SAP standard Collective Search help of the Field in the transaction code of the business
object for which this functionality is developed.

Final Output:

- After development and activation two separate search modes are added as tab strips to the F4 search help of the
Eg: Screen shot of F4 for material field of transaction code MM02/3 after SES- TREX enablement:

Related Content:
Complete documentation of Business Object Search with SES for developers, including a demo example
Administration of the Search Engine Service
TREX RFC connection
http://help.sap.com/saphelp_erp2005/helpdata/en/19/752e4241f51a2ae10000000a1550b0/frameset.htmReference 2