Learn how you can install Text Retrieval and Information Extraction for Internet Sales to augment your E-Commerce functionality. Although the Basis team usually works with the CRM team on the implementation, the roles are often not clearly defined, which can lead to redundancy. These tips help the CRM team avoid this overlap by explaining how to complete the installation without relying on the Basis team.
Key Concept
Text Retrieval and Information Extraction (TREX) is a search and classification engine that SAP offers as an extension to many of its systems, including E-Commerce. It offers services for searching, classifying, and mining of data either in documents or business objects. You can install TREX as a standalone engine and use it in many SAP applications, including SAP CRM. A part of the search integration capabilities in SAP NetWeaver, TREX supports the search technology and functions for Search Engine Service for structured or unstructured searches.
Using Text Retrieval and Information Extraction (TREX) with Internet Sales (ISA), also known as E- Commerce, can help you improve your system’s performance, enhance product searches, and retrieve documents. It offers enhanced search capabilities not delivered as part of the standard E-Commerce platform. TREX also offers an ABAP- or Java-based design, which provides enhanced content and increased flexibility. This allows for product searches with multiple languages and fuzzy logic, document and image cataloging, and load balancing for a scalable architecture.
I recently worked with a client to troubleshoot its TREX implementation in ISA. As with any SAP component, installing TREX has no defined hand-off when it comes to task assignments of who does what. Basis resources usually tell you they are only responsible for installing the component. As such, the installation of TREX involves not only installing the component, but configuring it as well. This requires two or even three separate resources to work collectively to get the job done. If the CRM functional resource can handle these tasks, you can avoid redundancy.
I’ll show you how you can use TREX to take on what is typically a Basis task so you can perform most of the core tasks (installation, configuration, and troubleshooting techniques) on your own. In addition, I include examples with supporting references to streamline this process to minimize downtime incurred in troubleshooting errors and decrease installation time. My example illustrates the installation of a TREX 6.1 instance with an ISA 4.0 (ERP edition) implementation and an R/3 4.6C back- end system.
I describe the lessons learned in two different TREX projects — uninstalling a current TREX instance and installing a fresh instance of TREX. The steps noted here take into consideration the use of SAP Best Practices documentation, such as “Search and Classification (TREX) 6.1,” which you can find on SAP Service Marketplace. Note that you are not required to perform both procedures — either you have an issue with your current TREX component that requires you to perform an uninstall or you are installing TREX for the first time.
Note It is important that you refer to the Best Practices document, “Search and Classification (TREX) 6.1,” as your primary source of information and integrate the instructions in this article to fill in the gaps before you install or uninstall TREX. The documentation contains key SAP Notes to ensure that your installation goes smoothly. Additionally, SAP provides troubleshooting techniques to avoid installation failures. For more information, visit SAP Service Marketplace at
https://service.sap.com/sapinstfeedback.
Uninstall TREX
Before you uninstall TREX, it is important to have the TREX DVD that you used when you installed it initially because it contains options for repairing or uninstalling the current version. Otherwise, having a local copy of the contents on your machine can also do the trick.
If you do not have this DVD, you must download it from SAP Service Marketplace or request a new copy from SAP to perform this step. You can choose to uninstall the component from the DVD or copy the contents of that DVD to a disk drive and execute from that location. The instructions for uninstalling TREX from the SAP documentation are fairly straightforward. However, take note of these tips:
Tip 1: Make sure to use a logon ID that has sufficient rights on the computer. Picking an administration account is ideal and recommended. In this situation, it is advisable to use the Java 2 Platform, Enterprise Edition (J2EE) account. Not using an administration account will likely cause the uninstall process to fail.
Tip 2: When prompted to enter the user that you created for the instance, it is imperative that you only use the logon ID that your technical team set up initially for that instance. If you use any other existing ID and password, the uninstall process fails. If you do not know what user ID and password the technical team created for the instance, contact your Basis or network team for further assistance.
Tip 3: If you encounter an exception based on integer conversion while uninstalling, do the following:
Step 1. Locate the file, version.xml. Usually you find this file in the system path, : usrsaptrex_03docversion.xml. The file noted appears in a modified form. The file name is not version.xml, but is stored as an extension of that name, for example (versionxxx.xml). You must rename that file back to its correct file name, version.xml. If you find additional references for this file, such as version.bak, delete these files from this folder.
Step 2. Attempt the uninstall process again. This time no exceptions should occur. However, if you encounter any further exceptions, view the detailed log file to troubleshoot accordingly.
Tip 4: If you encounter an exception that states that the system cannot identify or find the TREX instance, follow these steps:
Step 1. Find the version.xml document by going to the following directory, :usrsaptrex_03docversion.xml. Open the document in Notepad or any other text editor program and ensure that any instance settings are modified to reflect the current version in the system correctly. These references appear as trex_xx (xx = instance number for TREX). You can verify the instance number by expanding the system path structure, :/usr/ sap/trex_xx. Also verify that the user noted in this file is indeed the user created for this instance. If you are not comfortable with modifying this file, request assistance from your Basis team.
Step 2. Attempt the uninstall process again. This time no exceptions should occur. However, if you encounter any further exceptions, view the detailed log file to troubleshoot accordingly.
Install TREX
Before installing TREX it is important to have the TREX DVD. You can choose to install the component from the DVD or copy the contents of that DVD to a disk drive and execute from that location. The instructions for installing TREX from the SAP documentation are fairly straightforward. However take note of the tips below. In my example, the client installation method I selected for this procedure was HTTP Server. I had a choice to either use Remote Function Call (RFC) Server, HTTP Server, or both. I was interested in executing TREX functions via a Web browser, so HTTP Server was the required selection in this case.
Tip 1: Know your game plan. When installing TREX you must decide which client to install. TREX offers two applications: Java and ABAP. These applications communicate with TREX servers based on different protocols and components.
- The ABAP application communicates with TREX using an RFC protocol and requires integration with an SAP Gateway and RFC Server. If you decide to deploy this client, you must select the Install RFC Server check box and enter the SAP Gateway details during the installation process. If you do not have SAP Gateway information, request this from your Basis team. The SAP Gateway details are required to install the RFC Server.
- The Java application communicates with TREX via HTTP or HTTPS protocols using a Web server that is enhanced to handle TREX-specific functions. If this option is the desired application, select the checkbox Install HTTP Server during the installation process.
You can select Install HTTP Server, Install RFC Server, or both. Note that you are not required to select both options and only need one of the options for TREX communication with your desired application. The decision to select RFC Server versus HTTP Server is requirement driven. The primary difference between the two is that the RFC Server uses the back end to push changes to TREX. In contrast, the HTTP Server option uses a Web-based application (r3trex) that requests the information from the back end. It also offers scheduling options to automatically pull information from the back end on a designated schedule. Each of these options is found in the installation sequence and presented in check boxes that you can select.
Tip 2: If you install TREX on a Microsoft Windows platform, review your Microsoft Internet Information Services (IIS) settings. It is possible that the TREXHTTPServer virtual directory was installed improperly. You usually find this item under the Web site created for your TREX instance. Verify that the virtual directory is labeled properly such as TREXHTTPServer_xx (xx = TREX instance). Also, validate that there is a complete folder structure for the virtual directory.
If the virtual directory was installed improperly, delete the directory from the Web site and reinstall it according to the exact requirements listed in the section, “Create a Web Site Manually (Only Windows)” from the “Search and Classification TREX 6.1” document. Begin on step 4 (page 67). Make sure to restart the Web site or stop and start IIS when you save changes.
Tip 3: If you are installing TREX on a Windows platform and you have IIS version 6.0 running, a reference contained on page 46 in the “Create a Web Service Extension” section of the “Search and Classification TREX 6.1” document provides an incorrect .dll notation. Instead enter the following:
:usrsapTREX_TREXHTTPServer.dll
Tip 4: If you selected the option Install HTTP Server when you installed TREX, it creates a service called HTTP Server in the TREX Admin tool. You can find this service in the Services link for the TREX tool. However, the service may not start. Ensure that you follow all steps of the installation document closely. If after this inspection the HTTP Server still does not start, locate the file (TREXWebServer.ini) found in the system path :usrsapTREX_. Open the file with Notepad or any other text editor program and remove the domain and .dll reference. Your changes should appear as shown in Figure 1. Save your changes and restart TREX. This fixes your HTTP Server issue. Note that you must add an instance number after TREXHTTPServer_ (if applicable). The .dll name is different as well.
Before change URL=https://mytrexhost.mydomain:/TREXHTTPServer/TREXIsapiExt.dll After change URL=https://mytrexhost:/TREXHTTPServer_/TREXHTTPServer.dll |
Figure 1 | Adjustments to TREXWebServer.ini file |
Post-Installation Activities
After you install TREX, you must create a database for TREX to use in replication activities. You also must test the success of the installation.
Tip 1: Create a database for TREX. You need a database for TREX if you want to use scheduling features found in the TREX Catalog Administration tool. These scheduling features are useful because they allow for automated handling of product, image, and document synchronization between the back end (CRM, SAP ERP Central Component [ECC]) and TREX without any user interaction. The process involves three steps. Refer to SAP’s installation guide, “CRM 4.0 SP06 – 6.20 Java Components of E-Selling and Channel Management on a SAP J2EE Engine 6.20,” also available on SAP Service Marketplace.
Step 1. Create a database user (see page 25 of the installation guide)
Step 2. Install tables for Java shopping basket and TREX R/3 (see page 26 of the installation guide)
Step 3. Assign the database user to the Internet Sales database (see page 25 of the installation guide)
Note
While the version of the SAP J2EE Engine may not seem to apply to those who are running Web Application Server (Web AS) 6.10 or later, the tips still hold true for most scenarios.
Tip 2: Test the installation. After you complete the TREX installation, it is important that you test the success of your installation by executing the Python test script, runInstallationTest.py, to test the basic TREX functions. This script calls a subset of TREX tests to verify the functional integrity of TREX and helps you determine if the basic functions of TREX are installed properly and running satisfactorily. Follow these four steps to run the test:
Step 1. Log on with your TREX instance user.
Step 2. Open the TREX test console. Follow menu path Start>Programs or All Programs>SAP TREX>Instance>Tools>TREX_>Console.
Step 3. Ensure that you are in the proper directory. The system path should be: :usrsaptrex_python_support.
Step 4. Execute the test script, runInstallationTest.py. If the test is successful you see the message, TREX is running well.
A typical outcome of running the Python test script is that your test fails in seven separate instances. When you review the points of failure, you will find that one of the error messages is General Configuration Error (2030) shown in Figure 2. You encounter this error either after you run the Python execution script or when you try to replicate product catalogs from R/3 to your TREX server. The primary cause of this failure is due to lack of security rights for the TREX instance user. To resolve this issue, extend the user folder rights to the following system path, : usr/sap.

Figure 2
Python test script error message
For the system path mentioned (: usr/sap) first ensure that it is a shared folder. Right-click on the network folder and select Properties from the list. Then click on the Sharing tab and verify that you have selected the Share this folder option and that the system has granted the proper permissions to the user. Finally, click on the Security tab and add the user while also assigning it with read and execute permissions. Click on the Apply button or the OK button to save your settings. This solves the error, so you should re-run the Python installation script to ensure that the TREX is indeed error free.
Tip 3: Configure the UI. All instructions leading to this step pertain to the baseline installation of the TREX component. The deployment method for this procedure consists of the HTTP Server, so you must now configure the Web-based application (UI) that the user manages when replicating information from the back end to TREX. It is important that your Basis team has deployed the relevant TREX.ear (enterprise archive) file. If they have not, you cannot proceed further. Follow these six steps to complete the TREX configuration.
Step 1. Activate the TREX application. Begin by creating an instance of your TREX application by launching the URL https:///trexr3/admin/xcm/init.do. are settings defined by your network and Basis teams and change with each implementation. Consult with your technical team to determine the proper URL settings.
You must configure two key areas in Extended Configuration Management (XCM): Java Connector (JCo) and the catalog. The JCo setting allows TREX to communicate with your R/3 or ECC system. Copy the file, rename it, and save it to a common, shared location where you store other XCM and XML files. Now enter a name for your TREX instance and click on the create button found on the right side of the screen in Figure 3.

Figure 3
Set up JCo
Next, set up the catalog setting, which is necessary for your TREX environment to establish connectivity with all server components. You should use the base template file, catalog-site-configR3 TREX.xml, which you can find in the following system path: : usrsapJ2EJC00j2eeclusterserver0 appssap.comcrm.trexr3servlet_jsptrexr3 rootadminxcmsample.
On the next screen (Figure 4) create your catalogdata parameter. Select <> from the catalogdata field and then click on the catalog button. In the next screen, enter a Configuration Name for your catalog configuration and click on the create button. Leave the current active session open and in a separate window execute steps 2 and 3.

Figure 4
Create the catalogdata parameter
Step 2. Determine which path directory that you want to contain the TREX xml properties. Create a folder structure, which stores this file, and then link the file path to the XCM configuration here.
Step 3. Copy the catalog site configuration file and paste it into the TREX folder. After determining the file storage location, open your renamed catalog site file and modify the areas of the file that are in bold per your customer requirements (Figure 5).
tcpip://your.server.com:8355text- at-installation your.trex.nameserver.url.first?> is the trex server instance number —>
https://nspald12:8000/text-at-installation your.trex.replicationscript.url.first?> http your.trex.host 10.20.23.83 8351 is the trex server instance number —> your.trex.host 8353 is the trex server instance number —>
/TREXHttpServer/TREXHttpServer.dll?httpFile> /TREX?—> |
Figure 5 | Modify the boldface code to reflect your TREX instance |
You can modify this file in Notepad or any text editor that allows for text changes and saved in that respective format. I used Notepad for this example. After you complete step 3, proceed to step 4 by going back to your open, active TREX session.
Step 4. Note the path where you stored the file and copy it to your customer XCM application. In my example, I stored the file at C:XCMTREXR3TREX.xml, which I copied into the XCM application in the catalogSiteConfigFile field. Click on the save configuration button. Next, click on the << back to configuration button and select your newly created catalog. Save before proceeding.
Step 5. Create the connection between TREX and your R/3 system. In the Configuration details screen, select create component configuration from the jcodata field and click on the jco button. The screen in Figure 6 appears. In the Parameter Configuration section, enter a configuration name for your JCo connection, such as sap_jco. Select server_connect for the Base Configuration field.

Figure 6
Set up the connection between TREX and R/3
Enter the rest of the required field information for the connection and save. Then click on the run test button to ensure the connection is successful. If your test is successful, you’ll see the results in the screen shown in Figure 7. Close that window, select your newly created JCo configuration, assign it, and save.

Figure 7
Successful test screen
Step 6. Restart the TREX application to implement your changes. You can either restart the J2EE Server or stop and start the TREX application via Visual Administrator. Stopping and starting the TREX application from Visual Administrator is the best option because it allows you to restart the selected application without affecting other applications. Additionally, the time to execute this task is seconds when conducted in Visual Administrator as opposed to minutes when restarting the J2EE. If you are not sure about this step, refer to your Basis support for further assistance.
Finally, open a Web session and enter the following URL, https:///trexr3/b2x/admin/init.do. As before, represents settings defined by your network and Basis teams. This changes with each implementation, so consult with your team to determine proper URL settings. Your TREX application should now launch successfully when executed (Figure 8).

Figure 8
Successfully installed TREX application
Now that you have launched your TREX application successfully, you can leverage all of the benefits TREX provides, such as scheduling and monitoring. Your E-Commerce application now points to TREX instead of the back-end system, allowing for increased performance and load balancing.
Gil Magana
If you have comments about this article or publication, or would like to submit an article idea, please contact the editor.