Custom SES TREX Functionality Development in SAP

download Custom SES TREX Functionality Development in SAP

of 7

description

Custom SES TREX Functionality Development in SAP

Transcript of Custom SES TREX Functionality Development in SAP

  • 5/26/2018 Custom SES TREX Functionality Development in SAP

    1/

    Custom SES TREX Functionality

    Development

    created bySatish Nairon Jun 26, 2012 11:17 AM, last modified bySatish Nairon Jun 26, 2012 11:43 AMVersion 1inShare

    Custom Development for enabling full-text search for Business Objects in

    SAP

    Custom SES TREX FunctionalityApplies to:SAP NetWeaver 2004s, mySAP ERP 2005

    Created on:19-06-2012

    Author:Satish Nair, Capgemini, M, Sr. Consultant, AppsOne

    Summary:

    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 NetWeaversengine 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.

    Purpose: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 itslong

    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

    functionality

    http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/a751a1ec-0a01-0010-f0ba-

    89e4c5cd0261?QuickLink=index&overridelayout=true&5003637741546

    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

    class: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.

    http://scn.sap.com/people/satish.nair7http://scn.sap.com/people/satish.nair7http://scn.sap.com/people/satish.nair7http://scn.sap.com/people/satish.nair7http://scn.sap.com/people/satish.nair7http://scn.sap.com/people/satish.nair7http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/a751a1ec-0a01-0010-f0ba-89e4c5cd0261?QuickLink=index&overridelayout=true&5003637741546http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/a751a1ec-0a01-0010-f0ba-89e4c5cd0261?QuickLink=index&overridelayout=true&5003637741546http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/a751a1ec-0a01-0010-f0ba-89e4c5cd0261?QuickLink=index&overridelayout=true&5003637741546http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/a751a1ec-0a01-0010-f0ba-89e4c5cd0261?QuickLink=index&overridelayout=true&5003637741546http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/a751a1ec-0a01-0010-f0ba-89e4c5cd0261?QuickLink=index&overridelayout=true&5003637741546http://scn.sap.com/people/satish.nair7http://scn.sap.com/people/satish.nair7
  • 5/26/2018 Custom SES TREX Functionality Development in SAP

    2/

    Example: Create a custom indexing class ZCL_ERP_SE_BUS1019for 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_VALUESis coded for BUS1019 for base table PLKO to extract attributes

    PLNTY,

    http://scn.sap.com/servlet/JiveServlet/showImage/102-29533-1-113822/Untitled.pnghttp://scn.sap.com/servlet/JiveServlet/showImage/102-29533-1-113815/Untitled.pnghttp://scn.sap.com/servlet/JiveServlet/showImage/102-29533-1-113822/Untitled.pnghttp://scn.sap.com/servlet/JiveServlet/showImage/102-29533-1-113815/Untitled.png
  • 5/26/2018 Custom SES TREX Functionality Development in SAP

    3/

    PLNNR, PLNAL and short text LTXT. Sample code for this method for extracting PLNTY is

    shown

    below: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 ).

    lr_assist->add_attribute_value (

    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.

    lr_assist->add_attribute_value (

    iv_name = gc_fieldname_plnty

    iv_dd_obj = gc_rollname_plnty

    iv_value = ls_plko_total-plntyiv_content_relevant = 'X').

    endloop.

    Additional method ADD_TEXT_TO_CONTENTis added for extracting long text. This method

    is

    called from the method GET_ATTRIBUTE_VALUE.The code snippet for this method is given

    below:

    CALL FUNCTION 'READ_TEXT'

    http://scn.sap.com/servlet/JiveServlet/showImage/102-29533-1-113823/Untitled.png
  • 5/26/2018 Custom SES TREX Functionality Development in SAP

    4/

    exporting

    id = iv_id

    language = iv_langu

    name = iv_name

    object = lc_object

    tables

    lines = lt_tline

    exceptionsothers = 0.

    CALL FUNCTION 'CONVERT_ITF_TO_ASCII'

    EXPORTING

    tab_substitute = ' 1'

    IMPORTING

    c_datatab = lt_ascii

    TABLES

    itf_lines = lt_tline.

    IF NOT lt_ascii IS INITIAL.

    LOOP ATlt_ascii ASSIGNING .

    CONCATENATE ls_content-content

    INTO ls_content-contentSEPARATED BY space.

    endloop.

    endif.

    if not ls_content-content is initial.

    call method ir_assist->add_content

    exporting

    iv_value = ls_content-content.

    endif.

    Configuration (SPRO) Steps:

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

  • 5/26/2018 Custom SES TREX Functionality Development in SAP

    5/

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

    http://scn.sap.com/servlet/JiveServlet/showImage/102-29533-1-113828/Untitled.pnghttp://scn.sap.com/servlet/JiveServlet/showImage/102-29533-1-113824/Untitled.pnghttp://scn.sap.com/servlet/JiveServlet/showImage/102-29533-1-113828/Untitled.pnghttp://scn.sap.com/servlet/JiveServlet/showImage/102-29533-1-113824/Untitled.png
  • 5/26/2018 Custom SES TREX Functionality Development in SAP

    6/

    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 exitCOM_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

    field.Eg: Screen shot of F4 for material field of transaction code MM02/3 after SES- TREX enablement:

    http://scn.sap.com/servlet/JiveServlet/showImage/102-29533-1-113829/Untitled.png
  • 5/26/2018 Custom SES TREX Functionality Development in SAP

    7/

    Related Content:Complete documentation of Business Object Search with SES for developers, including a demo example

    (SFLIGHT_SES)

    http://help.sap.com/saphelp_nw04s/helpdata/en/6a/9d9d427cab0831e10000000a1550b0/frameset.htmAdministration of the Search Engine Service

    http://help.sap.com/saphelp_erp2005/helpdata/en/27/08ef417fc65f24e10000000a1550b0/frameset.htm

    TREX RFC connection

    http://help.sap.com/saphelp_erp2005/helpdata/en/19/752e4241f51a2ae10000000a1550b0/frameset.htmReference 2

    http://help.sap.com/saphelp_nw04s/helpdata/en/6a/9d9d427cab0831e10000000a1550b0/frameset.htmhttp://help.sap.com/saphelp_nw04s/helpdata/en/6a/9d9d427cab0831e10000000a1550b0/frameset.htmhttp://help.sap.com/saphelp_erp2005/helpdata/en/27/08ef417fc65f24e10000000a1550b0/frameset.htmhttp://help.sap.com/saphelp_erp2005/helpdata/en/27/08ef417fc65f24e10000000a1550b0/frameset.htmhttp://help.sap.com/saphelp_erp2005/helpdata/en/19/752e4241f51a2ae10000000a1550b0/frameset.htmReference%202http://help.sap.com/saphelp_erp2005/helpdata/en/19/752e4241f51a2ae10000000a1550b0/frameset.htmReference%202http://scn.sap.com/servlet/JiveServlet/showImage/102-29533-1-113830/Untitled.pnghttp://help.sap.com/saphelp_erp2005/helpdata/en/19/752e4241f51a2ae10000000a1550b0/frameset.htmReference%202http://help.sap.com/saphelp_erp2005/helpdata/en/27/08ef417fc65f24e10000000a1550b0/frameset.htmhttp://help.sap.com/saphelp_nw04s/helpdata/en/6a/9d9d427cab0831e10000000a1550b0/frameset.htm