TREX ABAP Client: How to index file content?

Hello Colleagues,
We have installed TREX search engine and writing own solution by using ABAP Client. Everything is ok except files content like XLS, DOC and so on. When we try to post binary content to the FM TREX_EXT_INDEX it is not processed by TREX and only attributes search is available. I think something wrong with data types.
Test example:
  data lt_data type table of char100.
  data l_size type i.
  data lt_doc type trext_index_docs.
  data ls_doc type trexs_index_doc.
  call function 'GUI_UPLOAD'
    exporting
      filename   = 'D:test.xls'
      filetype   = 'BIN'
    importing
      filelength = l_size
    tables
      data_tab   = lt_data.
  ls_doc-doc_key = '00001'.
  ls_doc-doc_langu = 'EN'.
  ls_doc-doc_type = 'B'.
  ls_doc-mime_type = 'application/excel'.
  call function 'SCMS_BINARY_TO_STRING'
    exporting
      input_length = l_size
    importing
      text_buffer  = ls_doc-content
    tables
      binary_tab   = lt_data.
  append ls_doc to lt_doc.
  call function 'TREX_EXT_INDEX'
    exporting
      i_index_id            = me->index_id
      i_rfc_destination     = me->rfc_dest
      i_index_document_list = lt_doc.
Document is indexed without content. Why?

Hi Evgeni,
I realise this is a little late, but just in case you are still interested - or anyone else out there is:
Basically somewhere internally the FM 'TREX_EXT_INDEX' does the following with your ls_doc-content:
l_xstring = p_content_in. "(p_content_in == ls_doc-content)
If you look at the conversion rules in ABAP the xstring then expects the string to contain only the characters '0-9A-F'. Which your string does not have after calling the FM SCMS_BINARY_TO_STRING.
Thus you have to format your ls_doc-content differently. Basically you need to move the hex characters in your xstring into 'real characters'. Which will expand the string massively.
We solved the problem using the following Form:
form conv_content using value(raw_content) type string
               changing content            type string.
  data: lv_char   type c,
        lv_string type string.
  field-symbols:  type x.
  clear content. " init output.
  while raw_content is not initial.
    lv_char = raw_content(1).
    assign lv_char to  casting.
    lv_string = .
    concatenate content lv_string into content in character mode respecting blanks.
    shift raw_content left.
  endwhile.
endform.
Not exactly efficient, but you can call it just as you would call the FM SCMS_BINARY_TO_STRING (except you don't need the filesize). Then the TREX will index your MS-Office documents as long as they are not of type Office 2007 or newer. In that case there is another bug, where the mime_type you pass in the interface is only 50 Chars long - which is too short to fit the full docx mime type for example.
Regards,
Robin

Similar Messages

  • WebDynpro: How to read file content?

    Hi,
    My business scenario requires:
    1, The file name is passed in through inbound plug parameter
    2, I need to read the file content and then attach it to my CRM transaction
    Please share with me how to read the file content.
    The following approaches do not fit my scenario:
    1, UI element: FileUpload
    The reason is obvious: there is only file name parameter instead of any UI interface
    2, Function Module: GUI_UPLOAD
    The reason is that dump will happen in WebDynpro environment
    Thanks & Best Regards,
    David

    HI,
    Refer these links  -
    Get content document in WD abap
    Excel File to Internal Table

  • How to store file content in BLOB field MySql database using java

    Hi!
    i want to store the file content in a BLOB field in MySql database using java.
    Please help me out..........
    thanx in advance...
    bye

    i stored images in db, and retrieved them. like that cant i store pdf file in db, and retrieve it back using oracle db?
    Plz help me out how to put a file in db. i need complete code. thanks in advance.

  • How to debug file content conversion problems?

    Hi,
    I'm trying to debug a file content conversion problem.  I'm mapping a few nodes in an IDOC to a file of fixed length fields.  I'm using the "<Node A>.fieldFixedLengths", "<Node B>.fieldFixedLengths", "<Node C>.fieldFixedLengths", etc. parameters to specify the fixed length records.
    However, a certain node (for e.g. Node B) is causing a problem and if it is present in the IDOC, the output file does not get created.  Upon checking the XI monitor, I notice that the file gets mapped correctly and thus the problem lies when the file adapter does the file content conversion.  How do I debug this because there is no descriptive error in the XI log?  If this node is not present, the file gets generated fine.
    Thanks,
    Basant Gupta

    Hi,
    If your SXMB_MONI shows, success status, then go to RWB->Message Monitoring->Message display tool and then check Audit log for the analysis,
    So it wil help you debug the situation.
    If there is no error, then check RWB->Component Monitoring->Adapter Monitoring for you file communciation channel..
    /people/michal.krawczyk2/blog/2005/01/02/simple-adapter-and-message-monitoring
    Regards,
    Moorthy

  • How to find File Content converson error

    Hi All,
       If there is a problem with key field in the file content conversion, file is getting deleted from the source system, and SXMB_moni does not have any message, adapter monitor does not show any message, How to find the error?
    Thank you
    Ganges Leaves

    hi,
    do you see anything in the AFW message monitoring
    http://hostname:portnumber/MessagingSystem/monitor/monitor.jsp  
    Regards,
    michal
    <a href="/people/michal.krawczyk2/blog/2005/06/28/xipi-faq-frequently-asked-questions"><b>XI / PI FAQ - Frequently Asked Questions</b></a>

  • How to search file contents in finder?

    How do I search for file contents in finder? All I see is the option to search "This Mac" or "Edited."

    Under the partial results appearing under the search box is a + icon (next to save).  To see it, click on the toolbar somewhere so the results popup clears.  Then you can define your search.

  • How to send file content (whole) and map it to target field?

    Hi guys!
    I need to send whole file content in a one xml tag -
    so xml would look like this:
    <MesType>
      <Recordset>
        <filecontent>jksdhfkjsdhfkjsdhfkjhsdf</filecontent>
      </Recordset>
    </MesType>
    How to set up file sender adapter conversion params? I suppose there will be only one fieldSeparator, which's value will be eof. But how to write this eof?
    Thanx for help,
    Olian

    Hi Olian,
    you can use below mentioned parameters in your <b>Sender CC</b> under Content Conversion.
    <b>Recordset Structure</b>   Recordset,*
    Recordset.<b>endSeparator</b>  'nl'
    Recordset.<b>fieldNames</b>   Comp,DocType,RefDocNo  etc.
    Recordset.<b>fieldFixedLengths</b>   2,2,8 (give the length of fields values)
    Now in your message mapping your source message type should have one field as per your requirement, now as other mentioned use concat function to concat all source fields. The delimiter of cocat function will be as empty, so that after concatination there will be no spaces in your target file as per your requirement.
    Hope this will solve your problem.
    Regards,
    Sarvesh

  • How to display file contents on a web page

    On unix platform I have created a class that can read the contents of a file and display them to the standard output. But now i want to display these file contents on a web page through jsp. On JSP code I have imported this class and want to assign a record from a file and write it to the screen using html. I think the class needs to be modified in order to return the string record read from a file so that im able to access it from a jsp and assign it to a variable the I can display it on the screen. Can someone help me with these code?

    Actually, you mean Linksys.  BIG difference there.
    Linksys Business Series was accumulated into Cisco Small Business, since it was purpose built for small business, not residential/consumer grade.
    The new PVC2300 actually are Cisco branded on the case.
    The collateral you seek is protected by the business unit that supplies it, since it was placed on a portal that only Cisco registered partners can access.
    As I wrote, I already checked with the BU and they told me thats where it lives and not to hand it out.  I cannot override that. 
    I am not sure there are any secrets in there, but I dont make the rules, sorry.
    Do you want to be a Cisco Partner?   Sign up and gain access to everything you need to sell Cisco successfully to end customers?  If you tell me your geography (city/state/zip, I will have an ICAM call you and help recruit you.....
    Steve D
    Systems Engineer
    U.S. Partner Sales team
    RTP, N.C.

  • How to save file content in BLOB using ODI?

    We have unix server where the files are stored in a particular directory.
    I have to create one table in Oracle db which will have 2columns.
    One column will have filename & in another column i need to store file content(whatever that file has) which should be a BLOB type.
    There is no restriction on file type,it could be .txt,.xls,.jpg.
    Need help
    Edited by: user11090018 on Jun 9, 2010 4:24 AM
    Edited by: user11090018 on Jun 10, 2010 10:22 PM

    If you can give a detail explanation about your requirement then we may try to come up with a solution .....

  • How to store file content in database??????

    how to store file in database and retrived

    How to use Google to search for answers to questions that have been asked literally thousands of times previously??????
    How to post into the correct forum???????
    How to use less punctuation??????

  • How to ManipulateJar File Content?

    From another thread...
    Hi People,
    I have several probs with my application, which needs to manipulate jar files. Here's the background:
    There's a directory that contains 2 jar files - Prog1.jar and Prog2.jar. Prog2 is designed to change the contents of Prog1 and is called from the Main-Class application in Prog1.
    1. Is it possible for Prog2 to delete/replace/add files to Prog1 (without using Runtime.exec)?
    2. Is it possible for Prog2 to get the dir location of those files?
    3. Is it possible for Prog2 to get the absolute dir location of Prog1 itself?
    Thanks in advance!

    Well i dont exactly checked out if u can delete/replace/add in jar
    but u can read through the exact directories of a particular jar file &
    even u can read the content of a particular file
    also
    u can try this
    JarFile myJar=new JarFile("file path as string");
    Enumeration enum = jarFile.entries();
    while (enum.hasMoreElements()) {
    //print the directories & file names
    JarEntry myJarEntry=(JarEntry)enum.nextElement());
    String name=entry.getName(); //printing directories & filenames
    //u can even see file content if u know the files exact name
    //or u can chek for directory or file then see through it
    JarEntry myJarentryTest=myJar.getJarEntry("filename");
    InputStream ip=myJar.getInputStream(myJarentryTest);
    then u can read the content
    but i guess each time u have to create new jar
    if u want to manipulate it
    roy

  • Using ABAP Webdynpr How to Upload File and download file in SAP R/3

    Hi SAP GURUS ,
                             I wanted to save employee profile from ESS to SAP so i am creating ESS Application .
    For that I go with BDS Approach and create test program for this  I got success while uploading file in my folder
    which i have created with the help of class and content repository . but when i Using ABAP Webdynpro , i got error FM "BDS_BUSINESSDOCUMENT_CREATEF"  message " error_kpro " .
                           Also I wanted to use KM for storage of Documents and wanted to retrive with help of ABAP Webdynpro .
                           So pls tell me / mailed me the process , approach and if you have examples .
        Thanks in Advance ,
         Vishwassap at gmail

    Hi Vishwas,
    Check out the thread [Efficient way of saving documents uploaded|Re: Efficient way of saving documents uploaded by users; and check the blog by Raja Thangamani.
    Also check the thread [Export Images through Function Modules   |Export Images through Function Modules;.
    Hope it helps you.

  • How to display file content in browser using servlet..? urgent!!!

    hello,
    i am building a application for which when a user logs in he will we redirected to page where he will have one link ,with this link a file is associated.
    when user press that link he should be able to see that particular file in internet browser....
    now can anybody give me a code sample of how to display a file in browser....
    please reply me as soon as possible...

    thanks for your reply....
    but i don't want this....
    i want to read a file from disk into stream or buffer and from that again reading and printing in browser.....
    a servlet should be built for this....
    i wrote this but its not working
    ========================================================
    public class FilePrinting extends HttpServlet
         public void doPost(HttpServletRequest req,HttpServletResponse res)
              throws IOException,ServletException
              ServletOutputStream out=res.getOutputStream();
              res.setContentType("text/html");
              String fileURL="/mydomainWebApp/Test.htm";
              res.setHeader("Content-disposition","attachment; filename=" +="Test.htm" );
              BufferedInputStream bis=null;
              BufferedOutputStream bos=null;
              try
                   URL url = new URL( fileURL );
                   bis=new BufferedInputStream(url.openStream());
                   bos = new BufferedOutputStream(out);
                   byte[] buff = new byte[2048];
                   int bytesRead;
                   // Simple read/write loop.
                   while(-1 != (bytesRead = bis.read(buff, 0, buff.length))) {
                   bos.write(buff, 0, bytesRead);
              }catch(final MalformedURLException e)
                   System.out.println ( "MalformedURLException." );
                   throw e;
              }catch(final IOException e)
                   System.out.println ( "IOException." );
                   throw e;
              }finally
                   if (bis != null)
                        bis.close();
                   if (bos != null)
                        bos.close();
    =======================================================================
    please send me sample code if anyone have../...

  • HTML Client: How to get the content/value of a custom control?

    I made two Custom Controls named, "CustomControl_1" and "CustomControl_2". 
    In the render function of "CustomControl_1", how to access the value of "CustomControl_2"?
    For example,
    myapp.BrowseOrders.CustomControl_2_render = function (element, contentItem) {
    $(element).text("Some Value");
    myapp.BrowseOrders.CustomControl_1_render = function (element, contentItem) {
    $(element).text( Value of CustomControl_2 ? );

    I would recommend creating screen properties and binding the controls to those screen properties. Then you can easily get a reference to any value. See this article for an example of the process using custom controls:
    Using The Clippy Agent in the Visual
    Studio LightSwitch HTML Client
    Unleash the Power - Get the LightSwitch 2013 HTML Client / SharePoint 2013 book
    http://LightSwitchHelpWebsite.com

  • How to change file content in JAR

    I'm deploying a Java application using Webstart based on different jars.
    One of the jars contains a 'config' file. The config file contains paths to databases.
    The idea is that the user can change these paths (or other settings) using the application.
    This would mean that the content of Config file in the jar file should be updated once the user
    changed 'the settings'..
    Is this possible ? If so, thanks to explain in detail.
    Greetz,

    depends.
    If a user makes a change, you can record that change, possibly using the persistance service.
    Then when he starts again, you read in the default config, then read from the persistance store to override those defaults.
    You can not change the initial jar, that is really on the server, or cached on various users machines.
    /Andy

Maybe you are looking for

  • External USB drives slow

    Hi, I recently purchased 2 Seagate Freeagent 500gb. I was copying files from my old external to the new one and it was going to take a ridiculously long time. So I checked into it and found the drives were showing up on the "USB Bus" in System Profil

  • Batch Determination at Delivery

    We assign Storage Location per Shipping Point.. for example, Shipping POint 1000 should get from SLoc 0001. In the warehouse, we have two storage locations, 0001 & 0002. When we do automatic batch determination, if there are no stocks in 0001, it wil

  • Questions about DNG Profile Editor recipe code

    I have been playing around with DNG Profile Editor. With a text editor I made the following recipe: I have some questions: 1. Right now I have my control points at 60 saturation. Will using two points for each color (say 70 and 40) make my changes mo

  • How to create a page in three or more regions

    Hi to all: I want to create a page which will have more than three regions like a HTML-Frames work that you can put different regions How can I do in in OAFramework? Please help Ali

  • ACCOUNTWT in bapi BAPI_ACC_DOCUMENT_POST

    Hello, Is anybody using the BAPI_ACC_DOCUMENT_POST in ECC 6.0.  There is a new structure called ACCOUNTWT that is to be used for the Withholding tax.  Right now I have been unable to make it work using SE37.  Does anybody have any ideas?  My values a