<?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: Validate Input file Uploaded from the Presentation Server - Text Or Binary in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/validate-input-file-uploaded-from-the-presentation-server-text-or-binary/m-p/796926#M40554</link>
    <description>&lt;P&gt;&lt;SPAN class="mention-scrubbed"&gt;muthuraja.muthaiah&lt;/SPAN&gt; If you pass the uploaded file to CL_BCS, even if you don't know its format, just pass it unchanged, i.e. in binary mode (the only possible issue would be that the recipient could not read correctly the attachment if it's a text file and the user has a different character set, but anyway that's a well know issue that is not even handled by our favorite email softwares) : &lt;/P&gt;&lt;P&gt;doc-&amp;gt;ADD_ATTACHMENT( 
&lt;/P&gt;&lt;P&gt;I_ATTACHMENT_TYPE = 'EXT' 
&lt;/P&gt;&lt;P&gt;I_ATTACHMENT_SIZE = file_size_in_bytes &lt;/P&gt;&lt;P&gt;I_ATT_CONTENT_HEX = file_contents &lt;/P&gt;&lt;P&gt;I_ATTACHMENT_HEADER = value #( ( line = '&amp;amp;SO_FILENAME=' &amp;amp;&amp;amp; file_name ) ) ).&lt;/P&gt;</description>
    <pubDate>Mon, 14 Jan 2019 07:08:52 GMT</pubDate>
    <dc:creator>Sandra_Rossi</dc:creator>
    <dc:date>2019-01-14T07:08:52Z</dc:date>
    <item>
      <title>Validate Input file Uploaded from the Presentation Server - Text Or Binary</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/validate-input-file-uploaded-from-the-presentation-server-text-or-binary/m-p/796921#M40549</link>
      <description>&lt;P&gt;Once the File has been uploaded from the presentation server, I tried to analyze the data whether it is in Binary format or not. It was an basic checks on the input data like below. &lt;/P&gt;
  &lt;PRE&gt;&lt;CODE&gt;     if ( lv_data co '0123456789abcdefABCDEF' ).
        " Binary format
     else
        " Text format
     endif.
&lt;/CODE&gt;&lt;/PRE&gt;
  &lt;P&gt;But Is there any other standard solution or utitlity class will be there to check the binary data ?? &lt;/P&gt;
  &lt;P&gt;Thanks in Advance&lt;/P&gt;</description>
      <pubDate>Thu, 10 Jan 2019 05:40:56 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/validate-input-file-uploaded-from-the-presentation-server-text-or-binary/m-p/796921#M40549</guid>
      <dc:creator>Muthu_raja</dc:creator>
      <dc:date>2019-01-10T05:40:56Z</dc:date>
    </item>
    <item>
      <title>Re: Validate Input file Uploaded from the Presentation Server - Text Or Binary</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/validate-input-file-uploaded-from-the-presentation-server-text-or-binary/m-p/796922#M40550</link>
      <description>&lt;P&gt;Firstly,  your check for binary format is incorrect.  If that passes you will have a text file that contains the characters 0-9 and a-f,A-F with no linefeeds or carriage returns.&lt;/P&gt;&lt;P&gt;A binary file is a file that contains bytes with an ascii value between 0-255. A text file would contain values from Ascii 32 (Space) to Ascii 122 (z) plus the possibility of Linefeeds (10), Carriage returns (13) and tabs(09).  You can use class cl_abap_char_utilities to get these ascii values.&lt;/P&gt;&lt;P&gt;So I would check for a text file and assume everything else is a binary file.  I would also use a regex, rather than the SAP string searches.&lt;/P&gt;&lt;P&gt;Rich&lt;/P&gt;</description>
      <pubDate>Thu, 10 Jan 2019 08:48:43 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/validate-input-file-uploaded-from-the-presentation-server-text-or-binary/m-p/796922#M40550</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2019-01-10T08:48:43Z</dc:date>
    </item>
    <item>
      <title>Re: Validate Input file Uploaded from the Presentation Server - Text Or Binary</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/validate-input-file-uploaded-from-the-presentation-server-text-or-binary/m-p/796923#M40551</link>
      <description>&lt;P&gt;  &lt;SPAN class="mention-scrubbed"&gt;muthuraja.muthaiah&lt;/SPAN&gt; I agree with Richard: "your check for binary format is incorrect".&lt;/P&gt;&lt;P&gt;I'd give a different definition though, but I can only define what is a "text file" (a "binary file" is "what is not a text file", although we could also have "mixed files", which happens very frequently).&lt;/P&gt;&lt;P&gt;A text file contains only characters encoded in one given character set (A.K.A. code page) and is like a book humans can read and find a meaning.&lt;/P&gt;&lt;P&gt;Note that even a text or binary file is not sufficient to identify the nature of a file, which may be very different: a text file might contain plain text, CSV format, XML, and so on, and a binary file might be a PDF, XLSX, and so on.&lt;/P&gt;&lt;P&gt;99.9% of time, the program knows that the input file it has to process should be text or binary without even reading it first, and the program should parse and validate the file assuming a given format, and should trigger an error if it fails.&lt;/P&gt;&lt;P&gt;So, the big question is, why do you need to choose between "text" and "binary" ?&lt;/P&gt;&lt;P&gt;PS: the only frequent detection which might resemble your question is to recognize the code page of a text file uploaded by a user, because it may differ a lot although the decoded characters might be the same (for the word "café", English and French code pages would encode "é" differently)&lt;/P&gt;</description>
      <pubDate>Sat, 12 Jan 2019 13:51:34 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/validate-input-file-uploaded-from-the-presentation-server-text-or-binary/m-p/796923#M40551</guid>
      <dc:creator>Sandra_Rossi</dc:creator>
      <dc:date>2019-01-12T13:51:34Z</dc:date>
    </item>
    <item>
      <title>Re: Validate Input file Uploaded from the Presentation Server - Text Or Binary</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/validate-input-file-uploaded-from-the-presentation-server-text-or-binary/m-p/796924#M40552</link>
      <description>&lt;P&gt;Hi Sandra,   &lt;/P&gt;&lt;P&gt;"Note that even a text or binary file is not sufficient to identify the nature of a file, which may be very different: a text file might contain plain text, CSV format, XML, and so on,"&lt;/P&gt;&lt;P&gt;True,  but regardless of the format of the information inside the file,  it is still a text file.  I would classify a 'mixed' file as binary.....&lt;/P&gt;&lt;P&gt;Rich&lt;/P&gt;</description>
      <pubDate>Sat, 12 Jan 2019 17:31:21 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/validate-input-file-uploaded-from-the-presentation-server-text-or-binary/m-p/796924#M40552</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2019-01-12T17:31:21Z</dc:date>
    </item>
    <item>
      <title>Re: Validate Input file Uploaded from the Presentation Server - Text Or Binary</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/validate-input-file-uploaded-from-the-presentation-server-text-or-binary/m-p/796925#M40553</link>
      <description>&lt;P&gt;Thanks  &lt;SPAN class="mention-scrubbed"&gt;richard.harper&lt;/SPAN&gt; and  &lt;SPAN class="mention-scrubbed"&gt;sandra.rossi&lt;/SPAN&gt; for your answers. &lt;/P&gt;&lt;P&gt;@ &lt;SPAN class="mention-scrubbed"&gt;sandra.rossi&lt;/SPAN&gt; I wanted to send mail with an attachments, I was using cl_bcs wrapper class and there will be two different parameters for add_attachment method ( text &amp;amp; binary ). So there might be a chance any type of files will be uploaded by User. I wanted to analyze the input file uploaded and call method parameters accordingly. This brought me to ask this question. &lt;/P&gt;&lt;P&gt;Thanks Again.&lt;/P&gt;</description>
      <pubDate>Mon, 14 Jan 2019 04:16:38 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/validate-input-file-uploaded-from-the-presentation-server-text-or-binary/m-p/796925#M40553</guid>
      <dc:creator>Muthu_raja</dc:creator>
      <dc:date>2019-01-14T04:16:38Z</dc:date>
    </item>
    <item>
      <title>Re: Validate Input file Uploaded from the Presentation Server - Text Or Binary</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/validate-input-file-uploaded-from-the-presentation-server-text-or-binary/m-p/796926#M40554</link>
      <description>&lt;P&gt;&lt;SPAN class="mention-scrubbed"&gt;muthuraja.muthaiah&lt;/SPAN&gt; If you pass the uploaded file to CL_BCS, even if you don't know its format, just pass it unchanged, i.e. in binary mode (the only possible issue would be that the recipient could not read correctly the attachment if it's a text file and the user has a different character set, but anyway that's a well know issue that is not even handled by our favorite email softwares) : &lt;/P&gt;&lt;P&gt;doc-&amp;gt;ADD_ATTACHMENT( 
&lt;/P&gt;&lt;P&gt;I_ATTACHMENT_TYPE = 'EXT' 
&lt;/P&gt;&lt;P&gt;I_ATTACHMENT_SIZE = file_size_in_bytes &lt;/P&gt;&lt;P&gt;I_ATT_CONTENT_HEX = file_contents &lt;/P&gt;&lt;P&gt;I_ATTACHMENT_HEADER = value #( ( line = '&amp;amp;SO_FILENAME=' &amp;amp;&amp;amp; file_name ) ) ).&lt;/P&gt;</description>
      <pubDate>Mon, 14 Jan 2019 07:08:52 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/validate-input-file-uploaded-from-the-presentation-server-text-or-binary/m-p/796926#M40554</guid>
      <dc:creator>Sandra_Rossi</dc:creator>
      <dc:date>2019-01-14T07:08:52Z</dc:date>
    </item>
  </channel>
</rss>

