<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: fm or method for converting  doc,pdf or text  files to binary format in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/fm-or-method-for-converting-doc-pdf-or-text-files-to-binary-format/m-p/3552328#M854690</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you want to read a Word file as a Word file directly - i.e. not converted to text - then you have to work out/find out the internal format, and write a program to handle it. Effectively an ABAP version of a Word Document viewer. Applications such as Open Office have managed to do this, but I think even with their source code, you'd have a very difficult task on your hands. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you are using the latest version of Word (2007), then you can comparitively easily write an XML parser for Microsoft Open Office XML (OOXML) &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It may be possible to write a Word VBA macro that extracts the information from the Word Document, which you could call from ABAP using OLE. But again, a lot depends on your SAP version and your version of Word. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Of course, you can simplify the problem dramatically by converting the word document to a text format,  then reading the text file by GUI_UPLOAD.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 20 Mar 2008 16:18:49 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2008-03-20T16:18:49Z</dc:date>
    <item>
      <title>fm or method for converting  doc,pdf or text  files to binary format</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/fm-or-method-for-converting-doc-pdf-or-text-files-to-binary-format/m-p/3552327#M854689</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Are you aware of any function module or method which takes input as a file of type doc, pdf or text files and convert it to binary format? Kindly let me know.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This is what i tried and was unsuccessful.&lt;/P&gt;&lt;P&gt;i tried using gui_upload method and pass " asc" as file type while importing file of type .doc but it returns me string filled with strange characters.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I did try converting this string to xstring using  cl_proxy_service=&amp;gt;cstring2xstring but i realized my 1st step of uploading file itself was wrong.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please let me know what can be done if you are aware of how to convert file of various types to binary.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;thanks&lt;/P&gt;&lt;P&gt;Pooja&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 20 Mar 2008 15:55:10 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/fm-or-method-for-converting-doc-pdf-or-text-files-to-binary-format/m-p/3552327#M854689</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-03-20T15:55:10Z</dc:date>
    </item>
    <item>
      <title>Re: fm or method for converting  doc,pdf or text  files to binary format</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/fm-or-method-for-converting-doc-pdf-or-text-files-to-binary-format/m-p/3552328#M854690</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you want to read a Word file as a Word file directly - i.e. not converted to text - then you have to work out/find out the internal format, and write a program to handle it. Effectively an ABAP version of a Word Document viewer. Applications such as Open Office have managed to do this, but I think even with their source code, you'd have a very difficult task on your hands. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you are using the latest version of Word (2007), then you can comparitively easily write an XML parser for Microsoft Open Office XML (OOXML) &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It may be possible to write a Word VBA macro that extracts the information from the Word Document, which you could call from ABAP using OLE. But again, a lot depends on your SAP version and your version of Word. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Of course, you can simplify the problem dramatically by converting the word document to a text format,  then reading the text file by GUI_UPLOAD.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 20 Mar 2008 16:18:49 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/fm-or-method-for-converting-doc-pdf-or-text-files-to-binary-format/m-p/3552328#M854690</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-03-20T16:18:49Z</dc:date>
    </item>
    <item>
      <title>Re: fm or method for converting  doc,pdf or text  files to binary format</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/fm-or-method-for-converting-doc-pdf-or-text-files-to-binary-format/m-p/3552329#M854691</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Try this FM,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;C13Z_FILE_UPLOAD_BINARY &amp;#150; Uploads a file in binary format&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;C13Z_FILE_DOWNLOAD_BINARY &amp;#150; Downloads a file in binary format&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;and i think you should use 'BIN' in the gui_upload .&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 20 Mar 2008 16:24:01 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/fm-or-method-for-converting-doc-pdf-or-text-files-to-binary-format/m-p/3552329#M854691</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-03-20T16:24:01Z</dc:date>
    </item>
    <item>
      <title>Re: fm or method for converting  doc,pdf or text  files to binary format</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/fm-or-method-for-converting-doc-pdf-or-text-files-to-binary-format/m-p/3552330#M854692</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi All,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;thanks alot for the information and help provided by all of you.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I did figure out a way where the word document or pdf  can be pretty much loaded with gui_upload. the file type used in the method would be "BIN" the following thing has to be done. declare data type as given below and file would be the complete path along with document name which has to be uploaded&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA: BEGIN OF res_line,&lt;/P&gt;&lt;P&gt;            raw(255) TYPE x,&lt;/P&gt;&lt;P&gt;         END   OF res_line.&lt;/P&gt;&lt;P&gt;  DATA: res_tab LIKE res_line OCCURS 0 WITH HEADER LINE.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data :  wf_var_stringx TYPE xstring .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  CALL FUNCTION 'GUI_UPLOAD'&lt;/P&gt;&lt;P&gt;      EXPORTING&lt;/P&gt;&lt;P&gt;        filename                =  file&lt;/P&gt;&lt;P&gt;        filetype                = 'BIN'&lt;/P&gt;&lt;P&gt;        read_by_line            = 'X'&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;     has_field_separator     = ' '&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;     header_length           = 0&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;     header_line           = 'X'&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;      IMPORTING&lt;/P&gt;&lt;P&gt;        filelength              = l_filelength&lt;/P&gt;&lt;P&gt;      TABLES&lt;/P&gt;&lt;P&gt;        data_tab                = res_tab&lt;/P&gt;&lt;P&gt;      EXCEPTIONS&lt;/P&gt;&lt;P&gt;       OTHERS                  = 1.&lt;/P&gt;&lt;P&gt;*&lt;/P&gt;&lt;P&gt;LOOP AT res_tab .&lt;/P&gt;&lt;P&gt;    CONCATENATE wf_var_stringx res_tab-raw INTO wf_var_stringx IN BYTE MODE.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  ENDLOOP.&lt;/P&gt;&lt;P&gt;*&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;this will upload the file and will file the string x with its content.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;hope this helps to some of you.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;Pooja&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 31 Mar 2008 16:30:23 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/fm-or-method-for-converting-doc-pdf-or-text-files-to-binary-format/m-p/3552330#M854692</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-03-31T16:30:23Z</dc:date>
    </item>
  </channel>
</rss>

